Skip to content

Describe testing beforeunload in alerts.en.md #2266

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

dcki
Copy link

@dcki dcki commented Apr 9, 2025

User description

Description

Describe testing beforeunload in alerts.en.md

Motivation and Context

I'm working on upgrading the driver used by a test suite and it took me a long time to discover this information.

Related info: https://issues.chromium.org/issues/351858989#comment30

Types of changes

  • [?] Change to the site (I have double-checked the Netlify deployment, and my changes look good)
    • I'm not sure if this counts as a "change to the site"
  • Code example added (and I also added the example to all translated languages)
    • I don't think this is applicable.
  • Improved translation
  • [?] Added new translation (and I also added a notice to each document missing translation)
    • I'm not sure if this applies. I added new content in English and did not translate it, and I did not add any notices about missing translations.

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.
    • To be honest I haven't.
  • Sign the CLA
    • I'm willing to sign the CLA but I don't know how. Signed.

PR Type

Documentation


Description

  • Added a new section on beforeunload prompt behavior in alerts.en.md.

  • Explained default behavior changes for drivers released in 2024 and later.

  • Provided specific notes on ChromeDriver versions and configuration requirements.


Changes walkthrough 📝

Relevant files
Documentation
alerts.en.md
Added documentation for `beforeunload` prompt behavior     

website_and_docs/content/documentation/webdriver/interactions/alerts.en.md

  • Added a new section on beforeunload prompt behavior.
  • Explained default dismissal behavior for drivers from 2024 onwards.
  • Included ChromeDriver-specific notes on version behavior and
    configuration.
  • +8/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    netlify bot commented Apr 9, 2025

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit efbc9b5

    @CLAassistant
    Copy link

    CLAassistant commented Apr 9, 2025

    CLA assistant check
    All committers have signed the CLA.

    Copy link
    Contributor

    qodo-merge-pro bot commented Apr 9, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Version Specificity

    The documentation uses approximate version numbers and dates. Consider adding more precise information about when these changes were implemented, if available, to help users troubleshoot version-specific issues.

    Drivers released in approximately 2024 and later automatically dismiss beforeunload prompts by default. If the old behavior is needed, [enable bidi]({{< ref "../bidi/" >}}).
    
    NOTE: ChromeDriver still dismisses prompts unless `options.unhandled_prompt_behavior = 'ignore'` is also specified, in addition to enabling bidi (as recently as version 134 or later).
    
    NOTE: ChromeDriver implemented automatically dismissing beforeunload prompts in approximately version 126 but enabling bidi had no effect on beforeunload prompts until approximately version 133.

    Copy link
    Contributor

    qodo-merge-pro bot commented Apr 9, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Add implementation example

    Provide a code example showing how to set the unhandled_prompt_behavior option
    to 'ignore'. This would make the documentation more actionable for users who
    need to implement this configuration.

    website_and_docs/content/documentation/webdriver/interactions/alerts.en.md [184]

    -NOTE: ChromeDriver still dismisses prompts unless `options.unhandled_prompt_behavior = 'ignore'` is also specified, in addition to enabling bidi (as recently as version 134 or later).
    +NOTE: ChromeDriver still dismisses prompts unless `options.unhandled_prompt_behavior = 'ignore'` is also specified, in addition to enabling bidi (as recently as version 134 or later). For example:
    +```python
    +from selenium import webdriver
    +options = webdriver.ChromeOptions()
    +options.unhandled_prompt_behavior = 'ignore'
    +driver = webdriver.Chrome(options=options)
    +```
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    __

    Why: Adding a concrete code example significantly enhances the documentation by showing users exactly how to implement the described configuration. This transforms abstract instructions into actionable code, making it much easier for users to apply the solution in their own projects.

    Medium
    Clarify expected behavior

    Provide more specific information about what the "old behavior" is, to make it
    clear what happens when bidi is enabled. This helps users understand exactly
    what to expect.

    website_and_docs/content/documentation/webdriver/interactions/alerts.en.md [182]

    -Drivers released in approximately 2024 and later automatically dismiss beforeunload prompts by default. If the old behavior is needed, [enable bidi]({{< ref "../bidi/" >}}).
    +Drivers released in approximately 2024 and later automatically dismiss beforeunload prompts by default. If the old behavior (where beforeunload prompts are shown to the user) is needed, [enable bidi]({{< ref "../bidi/" >}}).
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion improves clarity by explicitly stating what the "old behavior" means (showing prompts to users). This enhancement makes the documentation more user-friendly and reduces potential confusion about what happens when bidi is enabled.

    Medium
    • More

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants