web scraping - python webscraping with selenium: trouble locating modal element -
i want go http://ted.com/talks, click "see topics" in "topics" dropdown, , click random letter heading, "c" or "d-e". however, don't know how find element in modal popup specific letter heading.
this letter heading elements when click "inspect element":
<li class="topic-select__range"> <a class = "topic-select__range__link" href="#" data-index="0">a-b</a> </li> <li class="topic-select__range"> <a class = "topic-select__range__link" href="#" data-index="1">c</a> </li> <li class="topic-select__range"> <a class = "topic-select__range__link" href="#" data-index="2">d-e</a> </li> ... etc.
my program can way see topics fine gets cannot locate element error when try click on letter headers. code snippet looks far:
# each header assigned number. header picked @ random, , clicked. # [error: cannot locate element.] random_letter = random.randint(0, 8) topics_window = browser.find_element_by_class_name("select-modal__content topic-select") # error here, when program tries find modal popup or tags within letter_headers = topics_window.find_element_by_class_name("topic-select__range__link") letter_headers[random_letter].click()
i couldn't find way access modal javascript content selenium. have instead found way using web api.
Comments
Post a Comment