Skip to content

Describe testing beforeunload in alerts.en.md#2266

Merged
diemol merged 4 commits into
SeleniumHQ:trunkfrom
dcki:patch-1
Jul 20, 2026
Merged

Describe testing beforeunload in alerts.en.md#2266
diemol merged 4 commits into
SeleniumHQ:trunkfrom
dcki:patch-1

Conversation

@dcki

@dcki dcki commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

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.
  • @netlify

    netlify Bot commented Apr 9, 2025

    Copy link
    Copy Markdown

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit efbc9b5

    @CLAassistant

    CLAassistant commented Apr 9, 2025

    Copy link
    Copy Markdown

    CLA assistant check
    All committers have signed the CLA.

    @qodo-code-review

    Copy link
    Copy Markdown
    Contributor

    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.

    @qodo-code-review

    qodo-code-review Bot commented Apr 9, 2025

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Add implementation example
    Suggestion Impact:The commit revised the same beforeunload guidance, replacing the Chrome-specific configuration note with a link to the unhandledPromptBehavior documentation instead of adding the requested inline Python example.

    code diff:

    -Drivers released in approximately 2024 and later automatically dismiss beforeunload prompts by default. If the old behavior is needed, [enable bidi]({{< ref "../bidi/" >}}).
    +Recent drivers automatically dismiss `beforeunload` prompts by default. To keep the old behavior,
    +see [unhandledPromptBehavior]({{< ref "../drivers/options#unhandledpromptbehavior" >}}).
     
    -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.

    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
    Suggestion Impact:The beforeunload guidance was rewritten to direct users to unhandledPromptBehavior for retaining the old behavior, rather than explicitly defining it as showing prompts or recommending BiDi.

    code diff:

    -Drivers released in approximately 2024 and later automatically dismiss beforeunload prompts by default. If the old behavior is needed, [enable bidi]({{< ref "../bidi/" >}}).
    +Recent drivers automatically dismiss `beforeunload` prompts by default. To keep the old behavior,
    +see [unhandledPromptBehavior]({{< ref "../drivers/options#unhandledpromptbehavior" >}}).

    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
    • Update

    diemol and others added 2 commits July 20, 2026 13:48
    Cross-reference the beforeunload/BiDi/ChromeDriver caveat from the
    alerts docs to the unhandledPromptBehavior section in options docs,
    where the capability is already documented per language, instead of
    duplicating binding-specific syntax inline. Added in all four
    languages.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    @netlify

    netlify Bot commented Jul 20, 2026

    Copy link
    Copy Markdown

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit 3da09a0
    🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/6a5e0b1e798acc00081cf933
    😎 Deploy Preview https://deploy-preview-2266--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.
    🤖 Make changes Run an agent on this branch

    To edit notification comments on pull requests, go to your Netlify project configuration.

    @netlify

    netlify Bot commented Jul 20, 2026

    Copy link
    Copy Markdown

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit 4e6191a
    🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/6a5e0d6f68ac520008ab45fe
    😎 Deploy Preview https://deploy-preview-2266--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.
    🤖 Make changes Run an agent on this branch

    To edit notification comments on pull requests, go to your Netlify project configuration.

    @qodo-code-review

    qodo-code-review Bot commented Jul 20, 2026

    Copy link
    Copy Markdown
    Contributor

    Code Review by Qodo

    🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

    Context used
    ✅ Compliance rules (platform): 10 rules

    Grey Divider


    Remediation recommended

    1. options.pt-br.md overlong note line ✓ Resolved 📘 Rule violation ✧ Quality
    Description
    Newly added documentation notes are written as single very long unwrapped lines, contradicting the
    style guide guidance to keep documentation source lines around 100 characters. This reduces
    readability and makes future diffs harder to review.
    
    Code

    website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md[440]

    +Nota: Para prompts de `beforeunload` especificamente, o ChromeDriver precisa que `ignore` seja definido além de ter o [BiDi]({{< ref "../bidi/" >}}) habilitado para manter o prompt aberto.
    Evidence
    The central style guide specifies that documentation source lines should be kept to around 100
    characters for readability, yet the newly added notes in the pt-br, zh-cn, and Japanese
    documentation files appear as single long unwrapped lines, directly conflicting with that guidance.
    

    Rule 2141344: Documentation changes must follow the central style guide file
    website_and_docs/content/documentation/about/style.en.md[40-45]
    website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md[440-440]
    website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md[430-430]
    website_and_docs/content/documentation/webdriver/drivers/options.ja.md[405-405]

    Agent prompt
    The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
    
    ## Issue description
    Newly added documentation notes are currently formatted as single very long unwrapped lines, which conflicts with the project style guide recommendation to keep documentation source lines to ~100 characters for readability and reviewable diffs.
    
    ## Issue Context
    The documentation style guide asks contributors to limit line lengths to around 100 characters to keep rendered source readable and make diffs easier to review. The recently added notes in multiple localized webdriver options docs (pt-br, zh-cn, and ja) are not wrapped accordingly.
    
    ## Fix Focus Areas
    - website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md[440-440]
    - website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md[430-430]
    - website_and_docs/content/documentation/webdriver/drivers/options.ja.md[405-406]
    - website_and_docs/content/documentation/about/style.en.md[40-45]
    

    ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


    2. alerts.pt-br.md overlong sentence ✓ Resolved 📘 Rule violation ✧ Quality
    Description
    The added beforeunload description is written as a single very long line, which contradicts the
    style guide guidance to keep documentation source lines around 100 characters. This reduces
    readability and makes future diffs harder to review.
    
    Code

    website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md[168]

    +Drivers recentes descartam automaticamente os prompts de `beforeunload` por padrão. Para manter o comportamento antigo, veja [unhandledPromptBehavior]({{< ref "../drivers/options#unhandledpromptbehavior" >}}).
    Evidence
    The central style guide specifies keeping documentation source lines to around 100 characters, but
    the newly added beforeunload paragraphs in the pt-br, zh-cn, and Japanese alerts documentation are
    each a single unwrapped long line, directly contradicting that guidance.
    

    Rule 2141344: Documentation changes must follow the central style guide file
    website_and_docs/content/documentation/about/style.en.md[40-45]
    website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md[168-168]
    website_and_docs/content/documentation/webdriver/interactions/alerts.zh-cn.md[170-170]
    website_and_docs/content/documentation/webdriver/interactions/alerts.ja.md[175-175]

    Agent prompt
    The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
    
    ## Issue description
    A newly added `beforeunload` documentation sentence is currently written as a single very long line in multiple localized docs, conflicting with the style guide line-length guidance (~100 chars).
    
    ## Issue Context
    The style guide asks contributors to limit documentation source line lengths to around 100 characters to keep documentation readable and diffs easier to review; the new `beforeunload` paragraphs in several locales were added as single unwrapped lines.
    
    ## Fix Focus Areas
    - website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md[168-168]
    - website_and_docs/content/documentation/webdriver/interactions/alerts.zh-cn.md[170-170]
    - website_and_docs/content/documentation/webdriver/interactions/alerts.ja.md[175-175]
    - website_and_docs/content/documentation/about/style.en.md[40-45]
    

    ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


    Grey Divider

    Qodo Logo

    Comment thread website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md Outdated
    Comment thread website_and_docs/content/documentation/webdriver/interactions/alerts.pt-br.md Outdated
    Qodo flagged the new ja/pt-br/zh-cn notes as single unwrapped lines
    (up to 209 chars), violating the line-length rule in the style guide.
    Wrap using semantic linefeeds; rendered output is unchanged since
    Markdown collapses the soft line breaks to a single space.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    @qodo-code-review

    Copy link
    Copy Markdown
    Contributor

    Code review by qodo was updated up to the latest commit 4e6191a

    @diemol
    diemol merged commit 4e8e129 into SeleniumHQ:trunk Jul 20, 2026
    6 checks passed
    selenium-ci added a commit that referenced this pull request Jul 20, 2026
    * Describe testing beforeunload in alerts.en.md
    
    Related info for ChromeDriver:
    
    https://issues.chromium.org/issues/351858989#comment30
    
    * Document beforeunload prompt behavior with unhandledPromptBehavior
    
    Cross-reference the beforeunload/BiDi/ChromeDriver caveat from the
    alerts docs to the unhandledPromptBehavior section in options docs,
    where the capability is already documented per language, instead of
    duplicating binding-specific syntax inline. Added in all four
    languages.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    
    * Wrap translated beforeunload notes to ~100 char lines
    
    Qodo flagged the new ja/pt-br/zh-cn notes as single unwrapped lines
    (up to 209 chars), violating the line-length rule in the style guide.
    Wrap using semantic linefeeds; rendered output is unchanged since
    Markdown collapses the soft line breaks to a single space.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
    [deploy site] 4e8e129
    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.

    3 participants