I would like to find an element on the page by id. The issue is that this element is only temporary and will not exist all of the time. Therefore I would like to set the default value so I can check for it in a conditional like so:
covidPopUp = driver.find_element_by_id("sgpb-popup-dialog-main-
div").extract(default='not-found')
if(covidPopUp == 'not-found'):
load_more_btn = driver.find_element_by_id("load_more_button")
load_more_btn.click()
else:
popUpClose = driver.find_element_by_id("sgpb-popup-close-button-6")
popUpClose.click()
However, this produces the following error:
AttributeError: 'WebElement' object has no attribute 'extract'