I need to refresh the page if the element is not there and proceed to downstream code whenever it appears. My code:
Button=False
while not Button:
try:
Btn = addButton = browser.find_element_by_class_name("my button")
print("Button isn't there")
time.sleep(1)
browser.refresh()
except:
Btn = addButton = browser.find_element_by_class_name("my button")
print("Button was clicked")
Btn.click()
Button = True
I need to fix the "try" part to check if the "my button" is NOT there, so it keeps refreshing the page