It seems that the example in Python (can't speak for the other languages, I'm only using python) is not the best suited :
wait = WebDriverWait(driver, timeout=2)
alert = wait.until(lambda d : d.switch_to.alert)
text = alert.text
alert.accept()
Seems to ONLY work if the alert is already present at the time the code runs. Which :
- Does not really correspond to the semantic of
wait.until
- Does not work if the alert is generated on the return of an
async function
Especially it seems there's a way made specifically for that :
from selenium.webdriver.support import expected_conditions as EC
# [...]
wait = WebDriverWait(driver, timeout=4)
alert = wait.until(EC.alert_is_present())
text = alert.text
alert.accept()
Maybe I missed it (then it's just me the moron) ... but kind of a bummer that I had to find it elsewhere than the docs ...
It seems that the example in Python (can't speak for the other languages, I'm only using python) is not the best suited :
Seems to ONLY work if the alert is already present at the time the code runs. Which :
wait.untilasyncfunctionEspecially it seems there's a way made specifically for that :
Maybe I missed it (then it's just me the moron) ... but kind of a bummer that I had to find it elsewhere than the docs ...