When I open the page a window alert occurs and I want to dismiss it but I tried every suggested solution and nothing has worked.
I tried the following commands right after self.get(url)
driver.execute_script("window.alert = function() { return true; }")
driver.switch_to.alert().dismiss()
try:
WebDriverWait(driver, 10).until(EC.alert_is_present(),
'Timed out')
alert = driver.switch_to.alert
alert.dismiss()
except TimeoutException:
print("There is no alert window.")
I'm using the chrome driver. My chrome is up to date and the I have the latest version of selenium