0

I'm trying to scrape data from this website called Anhembi

But when I try all the options from selenium to find elements, I get nothing. Anyone know why this happens?

I've already tried:

driver.find_element_by_xpath('//*[@class="agenda_result_laco_box"]') 

And made a for-loop through that to click in every single one and get the info I need which consists of the day, website and name of the events. How can I do that?

6
  • Can you give us manual steps after URL is opened? Commented Jul 30, 2018 at 16:34
  • Can u give a an example? Commented Jul 30, 2018 at 16:35
  • x = driver.find_element_by_name('month') print(range(len(x))) Commented Jul 30, 2018 at 16:36
  • What is your goal after web site is opened? Commented Jul 30, 2018 at 16:36
  • and range len of this thing returns [0,0] Commented Jul 30, 2018 at 16:36

1 Answer 1

1

Clearly, there is an iframe involved , you need to switch the focus of your web driver in order to interact with elements which are in iframe/frameset/frame.

You can try with this code :

driver.get("http://www.anhembi.com.br/agenda/") 

driver.switch_to.frame(driver.find_element_by_css_selector("iframe[src='http://intranet.spturis.com.br/intranet/modulos/booking/anhembisite_busca.php']"))
all_data = driver.find_elements_by_css_selector("div.agenda_result_laco_box")

print(len(all_data))

for data in all_data:
  print(data.text)
Sign up to request clarification or add additional context in comments.

5 Comments

can u explain me whats's an iframe, please?
iframe is basically , used to embed another document within the current HTML document. For more you can refer this : w3schools.com/tags/tag_iframe.asp
and how could i get all info of the + simbol too?
Didn't get you. all the info means ? With the above code you will get everything that is under Você buscou: JULHO DE 2018 and I don't know what +simbol is ?
If you are talking about the + sign which is just preceded by date , then you will have to click on each + sign one by one and scrape the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.