Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Python - JavaScript alerts, prompts and confirmations #1333

Open
paulotcj opened this issue Mar 11, 2023 · 3 comments
Open

[馃悰 Bug]: Python - JavaScript alerts, prompts and confirmations #1333

paulotcj opened this issue Mar 11, 2023 · 3 comments
Labels
bug Something isn't working waiting-answer

Comments

@paulotcj
Copy link

paulotcj commented Mar 11, 2023

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

@paulotcj paulotcj added bug Something isn't working needs-triaging labels Mar 11, 2023
@github-actions
Copy link
Contributor

@paulotcj, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

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:
https://github.com/SeleniumHQ/seleniumhq.github.io/tree/trunk/examples/python/tests/interactions/test_alerts.py so that we can see it passing? We want all code examples using code in selenium.dev, so alerts tests should use: https://www.selenium.dev/selenium/web/alerts.html

eaccmk added a commit to eaccmk/seleniumhq.github.io that referenced this issue Sep 9, 2023
@eaccmk
Copy link
Contributor

eaccmk commented Sep 9, 2023

Hi @paulotcj , @titusfortner ,
This issue will mostly be covered by #1470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting-answer
Projects
None yet
Development

No branches or pull requests

4 participants