-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🐛 Bug]: Python - JavaScript alerts, prompts and confirmations #1333
Comments
@paulotcj, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
After troubleshooting the issue, please add the Thank you! |
Hmm, I think the expected condition does switch to the alert? At any rate, we are trying to update all code examples to actual code in the examples directory of this repo so that we can ensure things are properly passing. (https://www.selenium.dev/documentation/about/style/#reference-github-examples) Is there any chance you'd be interested in writing that code in: |
Hi @paulotcj , @titusfortner , |
Can be closed. Current python code example is as follows:
|
Thank you, @shbenzer! |
What happened?
In the documentation, the first example for handling alerts in Python at the address: https://www.selenium.dev/documentation/webdriver/interactions/alerts/
is the following:
`driver.find_element(By.LINK_TEXT, "See an example alert").click()
alert = wait.until(expected_conditions.alert_is_present())
text = alert.text
alert.accept()`
However, this code will fail.
The probable solution as the example below hints, should be:
`driver.find_element(By.LINK_TEXT, "See an example alert").click()
WebDriverWait(driver, 10).until(expected_conditions.alert_is_present())
alert = driver.switch_to.alert
alert.accept()`
My apologies if I am missing something here.
What browsers and operating systems are you seeing the problem on?
Any
The text was updated successfully, but these errors were encountered: