Add comprehensive WebDriver BiDi examples for Python, Ruby, and C##2631
Add comprehensive WebDriver BiDi examples for Python, Ruby, and C##2631AutomatedTester wants to merge 23 commits into
Conversation
✅ Deploy Preview for selenium-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3fcbd56 to
8d94a30
Compare
|
some dotnet and python tests are failing please check @AutomatedTester . |
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
2424948 to
1548863
Compare
Add new test files for Python, Ruby, and C# covering BiDi features: - BrowsingContext: Create/navigate/manage windows and tabs - Script: Execute functions, evaluate, DOM mutations - Network: Intercept requests/responses, authentication - Input: Keyboard/mouse actions, drag-drop, events - LocateNodes: Find elements by CSS/XPath/selectors This fills the gap in multi-language BiDi example coverage, enabling documentation pages to reference working examples for all supported languages. Python added: - test_bidi_browsing_context.py (8 tests) - test_bidi_script.py (7 tests) - test_bidi_network.py (5 tests) - test_bidi_input.py (8 tests) - test_bidi_locate_nodes.py (8 tests) Ruby added/expanded: - browsing_context_spec.rb (13 specs) - script_spec.rb (8 specs) - input_spec.rb (9 specs) - locate_nodes_spec.rb (8 specs) - network_spec.rb (expanded with 4 tests) C# added: - BrowsingContextTest.cs (13 tests) - ScriptTest.cs (8 tests) - InputTest.cs (7 tests) - NetworkTest.cs (7 tests) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Python changes: - Wrapped long lines to conform to 79-character limit (E501) - Removed unused variable assignment in test_locate_nodes_by_class Ruby changes: - Fixed trailing whitespace on blank lines - Removed spaces inside hash literal braces All Python files now pass flake8 checks. All Ruby files now pass rubocop checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- browsing_context.en.md: Replace 8 placeholder badges with Ruby/Python code references - script.en.md: Replace 6 placeholder badges with Ruby/Python code references - network.en.md: Replace 4 placeholder badges with Ruby/Python code references - input.en.md: Replace 2 placeholder badges with Ruby/Python code references This enables rendering of examples on the Netlify preview. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b123779 to
be66359
Compare
Java: - Remove wait.until(alertIsPresent()) calls that timeout with BiDi mode - Keep boolean handleUserPrompt(true/false) fixes - Remove alertIsPresent import from BrowsingContextInspectorTest Ruby: - script_spec: Replace non-existent methods (evaluate, call_function, get_realms, disown) with working ones (add_console_message_handler, add_javascript_error_handler, add_dom_mutation_handler) - locate_nodes_spec: Move locate_nodes to BrowsingContext (not Script) - network_spec: Use add_authentication_handler (avoid intercept deadlocks) - input_spec: Use single_text_input.html which has the textInput element Python: - test_bidi_script: Replace non-existent methods with add_console_message_handler, add_javascript_error_handler, pin/unpin - test_bidi_input: Use single_text_input.html for the textInput element - test_bidi_network: Remove before_request/response_started intercept tests that deadlock; use add_auth_handler only .NET: - BrowsingContextTest: Rewrite using standard WebDriver API (BrowsingContext class does not exist in OpenQA.Selenium.BiDi in 4.44.0) - InputTest: Use single_text_input.html for the textInput element Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove duplicate 'locates multiple nodes' test which was identical to 'locates nodes by css selector'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dler - locate_nodes_spec: use driver.window_handle (Ruby) not current_window_handle (.NET/Java) - script_spec: remove add_dom_mutation_handler test (method does not exist in Ruby Selenium 4.44.0) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
locate_nodes is not implemented in Selenium::WebDriver::BiDi::BrowsingContext in Ruby 4.44.0. Use standard find_elements/find_element instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… has no divs) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Specify string parameter type in GetMethod() to resolve ambiguity when Logger.Warn has multiple overloads in Selenium 4.44.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- BrowsingContextTest/BrowsingContextInspectorTest: use WebDriverWait ignoring(BiDiException.class) to wait for alert before calling handleUserPrompt() - fixes 'no such alert' race condition - LogTest: remove assertNull(stackTrace) - Selenium 4.44.0 now provides a StackTrace for console.log entries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Prompt BiDi requires subscribing to userPromptOpened to make the alert accessible via handleUserPrompt. The previous WebDriverWait approach never worked because Firefox BiDi doesn't expose the alert until there's an active event subscription. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
click() blocks when it triggers an alert, causing Firefox to auto-dismiss the alert before handleUserPrompt() can be called. Use executeScript with setTimeout(0) to schedule the click asynchronously so the call returns immediately, allowing the userPromptOpened event to fire and handleUserPrompt() to succeed while the alert is still open. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove test using the-internet.herokuapp.com which can hang if the external site is slow or unreachable. Use selenium.dev instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
handleUserPrompt() requires Firefox to be configured with specific unhandledPromptBehavior settings to prevent auto-dismissal of alerts before the BiDi command can handle them. Skip these tests until a proper Firefox BiDi setup for user prompts is in place. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add new test files for Python, Ruby, and C# covering BiDi features:
This fills the gap in multi-language BiDi example coverage, enabling documentation pages to reference working examples for all supported languages.
Python added:
Ruby added/expanded:
C# added:
Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.
Description
Motivation and Context
Types of changes
Checklist