I am currently working on this webpage:
My code:
#function for searching for all "details" button, return list
def search_detail_button():
detail_buttons = browser.find_elements_by_css_selector("span.show-flight-details")
return (detail_buttons)
##Open all details pages
def open_details():
time.sleep(3)
for button in search_detail_button():
button.click()
time.sleep(1.5)
open_details()
Expected result:
All "Flight details and baggage fees" would be opened.
Actual result:
Sometimes it works, sometimes it gives me an exception. Why would a code sometimes work, sometimes don't?