Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for month in (month_start, month_end):
- for date in (date_start, date_end):
- try: #this is just a general try in case there is a breakdown in finding one of the elements
- driver.get(url)
- results = driver.find_elements_by_xpath("""//*[@class="results"]/div""")
- for result in results:
- sample_element = result.find_element_by_xpath("blah").text
- #seems to be where the problem starts
- specific_element = ""
- try:
- #this is a specific element that I know may not exist
- specific_element = result.find_element_by_xpath(""".//*[@class="specific"]/div""").text
- except NoSuchElementException:
- specific_element = ""
- #I have tried pass instead as well with no luck
- #throws an error here and won't continue if the specific element is not found
- except:
- #pretty much a copy of the above try with some changes
Add Comment
Please, Sign In to add comment