From bee73075b4da873829663bbe50c77821a5440453 Mon Sep 17 00:00:00 2001 From: Augustin Pequeno Date: Sat, 14 Dec 2024 16:17:26 +0100 Subject: [PATCH 01/10] Add BiDi network examples and documentation for Ruby --- examples/ruby/spec/bidi/network_spec.rb | 39 +++++++ .../webdriver/bidi/network.en.md | 99 +++++++++++++++++ .../webdriver/bidi/network.ja.md | 101 +++++++++++++++++- .../webdriver/bidi/network.pt-br.md | 101 +++++++++++++++++- .../webdriver/bidi/network.zh-cn.md | 101 +++++++++++++++++- 5 files changed, 438 insertions(+), 3 deletions(-) create mode 100644 examples/ruby/spec/bidi/network_spec.rb diff --git a/examples/ruby/spec/bidi/network_spec.rb b/examples/ruby/spec/bidi/network_spec.rb new file mode 100644 index 000000000000..630d294a2f9b --- /dev/null +++ b/examples/ruby/spec/bidi/network_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +RSpec.describe 'Network' do + let(:driver) { start_bidi_session } + let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } + + it 'adds an auth handler' do + network = driver.network + network.add_authentication_handler('username', 'password') + expect(network.callbacks.count).to be 1 + end + + it 'adds a request handler' do + network = driver.network + network.add_request_handler + expect(network.callbacks.count).to be 1 + end + + it 'adds a response handler' do + network = driver.network + network.add_response_handler + expect(network.callbacks.count).to be 1 + end + + it 'removes a handler' do + network = driver.network + id = network.add_request_handler + network.remove_handler(id) + expect(network.callbacks.count).to be 0 + end + + it 'clears all handlers' do + network = driver.network + network.add_request_handler + network.add_request_handler + network.clear_handlers + expect(network.callbacks.count).to be 0 + end +end diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.en.md b/website_and_docs/content/documentation/webdriver/bidi/network.en.md index 989ec39ca556..a420c6765866 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.en.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.en.md @@ -17,6 +17,105 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}}) ## Authentication Handlers +Authentication handlers enable you to intercept authentication requests that occur during a network interaction. +These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth. +They allow you to programmatically provide credentials or modify the authentication flow. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Request Handlers +Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server. +This can be used to modify request headers, change the request body, or block specific requests. +Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Response Handlers + +Response handlers enable you to intercept and manipulate incoming responses from the server. +They are particularly useful for testing scenarios involving response data, such as verifying or modifying response headers, status codes, or content before it reaches the browser. + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Remove Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Clear Handlers + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.ja.md b/website_and_docs/content/documentation/webdriver/bidi/network.ja.md index da4e2d7eb0ee..677c13e7f994 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.ja.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.ja.md @@ -5,7 +5,7 @@ weight: 1 description: > These features are related to networking, and are made available via a "network" namespace. aliases: [ - "/documentation/ja/webdriver/bidirectional/bidirectional_w3c/network", + "/documentation/en/webdriver/bidirectional/bidirectional_w3c/network", "/documentation/webdriver/bidirectional/webdriver_bidi/network" ] --- @@ -17,6 +17,105 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}}) ## Authentication Handlers +Authentication handlers enable you to intercept authentication requests that occur during a network interaction. +These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth. +They allow you to programmatically provide credentials or modify the authentication flow. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Request Handlers +Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server. +This can be used to modify request headers, change the request body, or block specific requests. +Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Response Handlers + +Response handlers enable you to intercept and manipulate incoming responses from the server. +They are particularly useful for testing scenarios involving response data, such as verifying or modifying response headers, status codes, or content before it reaches the browser. + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Remove Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Clear Handlers + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md b/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md index 60338930f815..677c13e7f994 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md @@ -5,7 +5,7 @@ weight: 1 description: > These features are related to networking, and are made available via a "network" namespace. aliases: [ - "/documentation/pt-br/webdriver/bidirectional/bidirectional_w3c/network", + "/documentation/en/webdriver/bidirectional/bidirectional_w3c/network", "/documentation/webdriver/bidirectional/webdriver_bidi/network" ] --- @@ -17,6 +17,105 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}}) ## Authentication Handlers +Authentication handlers enable you to intercept authentication requests that occur during a network interaction. +These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth. +They allow you to programmatically provide credentials or modify the authentication flow. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Request Handlers +Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server. +This can be used to modify request headers, change the request body, or block specific requests. +Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Response Handlers + +Response handlers enable you to intercept and manipulate incoming responses from the server. +They are particularly useful for testing scenarios involving response data, such as verifying or modifying response headers, status codes, or content before it reaches the browser. + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Remove Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Clear Handlers + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md b/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md index 4b97ed012af8..677c13e7f994 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md @@ -5,7 +5,7 @@ weight: 1 description: > These features are related to networking, and are made available via a "network" namespace. aliases: [ - "/documentation/zh-cn/webdriver/bidirectional/bidirectional_w3c/network", + "/documentation/en/webdriver/bidirectional/bidirectional_w3c/network", "/documentation/webdriver/bidirectional/webdriver_bidi/network" ] --- @@ -17,6 +17,105 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}}) ## Authentication Handlers +Authentication handlers enable you to intercept authentication requests that occur during a network interaction. +These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth. +They allow you to programmatically provide credentials or modify the authentication flow. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Request Handlers +Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server. +This can be used to modify request headers, change the request body, or block specific requests. +Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic. + +### Add Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ## Response Handlers + +Response handlers enable you to intercept and manipulate incoming responses from the server. +They are particularly useful for testing scenarios involving response data, such as verifying or modifying response headers, status codes, or content before it reaches the browser. + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Remove Handler + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + +## Clear Handlers + +{{< tabpane text=true >}} +{{< tab header="Java" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} +{{< /tab >}} +{{< tab header="Ruby" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} From f720c45e1d30a1effbdde0d2bc5f3deccbd205c7 Mon Sep 17 00:00:00 2001 From: Augustin Pequeno Date: Sat, 14 Dec 2024 16:22:14 +0100 Subject: [PATCH 02/10] Add skips until new Selenium release --- examples/ruby/spec/bidi/network_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/ruby/spec/bidi/network_spec.rb b/examples/ruby/spec/bidi/network_spec.rb index 630d294a2f9b..031d6befd1d9 100644 --- a/examples/ruby/spec/bidi/network_spec.rb +++ b/examples/ruby/spec/bidi/network_spec.rb @@ -4,32 +4,32 @@ let(:driver) { start_bidi_session } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } - it 'adds an auth handler' do + it 'adds an auth handler', skip: 'until Selenium release 4.28.0' do network = driver.network network.add_authentication_handler('username', 'password') expect(network.callbacks.count).to be 1 end - it 'adds a request handler' do + it 'adds a request handler', skip: 'until Selenium release 4.28.0' do network = driver.network network.add_request_handler expect(network.callbacks.count).to be 1 end - it 'adds a response handler' do + it 'adds a response handler', skip: 'until Selenium release 4.28.0' do network = driver.network network.add_response_handler expect(network.callbacks.count).to be 1 end - it 'removes a handler' do + it 'removes a handler', skip: 'until Selenium release 4.28.0' do network = driver.network id = network.add_request_handler network.remove_handler(id) expect(network.callbacks.count).to be 0 end - it 'clears all handlers' do + it 'clears all handlers', skip: 'until Selenium release 4.28.0' do network = driver.network network.add_request_handler network.add_request_handler From 96860ba81f7ff4fbab230a75658ef310ff245bd0 Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 22 Mar 2025 15:03:07 +0100 Subject: [PATCH 03/10] Fix tests --- examples/ruby/Gemfile | 4 +-- examples/ruby/spec/actions_api/keys_spec.rb | 3 +- examples/ruby/spec/bidi/network_spec.rb | 35 +++---------------- .../webdriver/bidi/network.en.md | 6 +--- .../webdriver/bidi/network.ja.md | 6 +--- .../webdriver/bidi/network.pt-br.md | 6 +--- .../webdriver/bidi/network.zh-cn.md | 6 +--- 7 files changed, 11 insertions(+), 55 deletions(-) diff --git a/examples/ruby/Gemfile b/examples/ruby/Gemfile index 5640080815fb..dd23c86ad048 100644 --- a/examples/ruby/Gemfile +++ b/examples/ruby/Gemfile @@ -7,5 +7,5 @@ gem 'rake', '~> 13.0' gem 'rspec', '~> 3.0' gem 'rubocop', '~> 1.35' gem 'rubocop-rspec', '~> 3.0' -gem 'selenium-devtools', '= 0.131.0' -gem 'selenium-webdriver', '= 4.27.0' +gem 'selenium-devtools', '= 0.134.0' +gem 'selenium-webdriver', '= 4.30.0' diff --git a/examples/ruby/spec/actions_api/keys_spec.rb b/examples/ruby/spec/actions_api/keys_spec.rb index 62acfb00e650..c6b97e41a4f1 100644 --- a/examples/ruby/spec/actions_api/keys_spec.rb +++ b/examples/ruby/spec/actions_api/keys_spec.rb @@ -56,8 +56,7 @@ expect(text_field.attribute('value')).to eq 'Selenium!' end - it 'copy and paste', except: {browser: :chrome, - reason: 'https://bugs.chromium.org/p/chromedriver/issues/detail?id=4264'} do + it 'copy and paste' do driver.get 'https://www.selenium.dev/selenium/web/single_text_input.html' wait.until { driver.find_element(id: 'textInput').attribute('autofocus') } diff --git a/examples/ruby/spec/bidi/network_spec.rb b/examples/ruby/spec/bidi/network_spec.rb index 031d6befd1d9..13b21ef6b7e0 100644 --- a/examples/ruby/spec/bidi/network_spec.rb +++ b/examples/ruby/spec/bidi/network_spec.rb @@ -4,36 +4,9 @@ let(:driver) { start_bidi_session } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } - it 'adds an auth handler', skip: 'until Selenium release 4.28.0' do - network = driver.network - network.add_authentication_handler('username', 'password') - expect(network.callbacks.count).to be 1 - end - - it 'adds a request handler', skip: 'until Selenium release 4.28.0' do - network = driver.network - network.add_request_handler - expect(network.callbacks.count).to be 1 - end - - it 'adds a response handler', skip: 'until Selenium release 4.28.0' do - network = driver.network - network.add_response_handler - expect(network.callbacks.count).to be 1 - end - - it 'removes a handler', skip: 'until Selenium release 4.28.0' do - network = driver.network - id = network.add_request_handler - network.remove_handler(id) - expect(network.callbacks.count).to be 0 - end - - it 'clears all handlers', skip: 'until Selenium release 4.28.0' do - network = driver.network - network.add_request_handler - network.add_request_handler - network.clear_handlers - expect(network.callbacks.count).to be 0 + it 'adds an auth handler', skip: 'Do not execute BiDi test' do + driver.network.add_authentication_handler('test', 'test') + driver.navigate.to url_for('basicAuth') + expect(driver.find_element(tag_name: 'h1').text).to eq('authorized') end end diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.en.md b/website_and_docs/content/documentation/webdriver/bidi/network.en.md index a420c6765866..1cb55e097150 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.en.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.en.md @@ -31,7 +31,7 @@ They allow you to programmatically provide credentials or modify the authenticat {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -55,7 +55,6 @@ Request handlers are essential for testing and debugging scenarios where you nee {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -76,7 +75,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -94,7 +92,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -112,7 +109,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.ja.md b/website_and_docs/content/documentation/webdriver/bidi/network.ja.md index 677c13e7f994..95a81f748645 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.ja.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.ja.md @@ -31,7 +31,7 @@ They allow you to programmatically provide credentials or modify the authenticat {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -55,7 +55,6 @@ Request handlers are essential for testing and debugging scenarios where you nee {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -76,7 +75,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -94,7 +92,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -112,7 +109,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md b/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md index 677c13e7f994..95a81f748645 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md @@ -31,7 +31,7 @@ They allow you to programmatically provide credentials or modify the authenticat {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -55,7 +55,6 @@ Request handlers are essential for testing and debugging scenarios where you nee {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -76,7 +75,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -94,7 +92,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -112,7 +109,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md b/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md index 677c13e7f994..95a81f748645 100644 --- a/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/bidi/network.zh-cn.md @@ -31,7 +31,7 @@ They allow you to programmatically provide credentials or modify the authenticat {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L8-L10" >}} +{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -55,7 +55,6 @@ Request handlers are essential for testing and debugging scenarios where you nee {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L14-L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -76,7 +75,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L20-L22" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -94,7 +92,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L26-L29" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} @@ -112,7 +109,6 @@ They are particularly useful for testing scenarios involving response data, such {{< tab header="CSharp" >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L33-L37" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< /tab >}} From 430e029bb849a26c75c7385cb0e873b36912abfc Mon Sep 17 00:00:00 2001 From: aguspe Date: Sat, 22 Mar 2025 16:40:44 +0100 Subject: [PATCH 04/10] Add guards --- examples/ruby/spec/actions_api/keys_spec.rb | 2 +- examples/ruby/spec/actions_api/mouse_spec.rb | 2 +- examples/ruby/spec/bidi/logging_spec.rb | 3 ++- examples/ruby/spec/bidi/network_spec.rb | 3 ++- examples/ruby/spec/drivers/remote_webdriver_spec.rb | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/ruby/spec/actions_api/keys_spec.rb b/examples/ruby/spec/actions_api/keys_spec.rb index c6b97e41a4f1..50d21b70c662 100644 --- a/examples/ruby/spec/actions_api/keys_spec.rb +++ b/examples/ruby/spec/actions_api/keys_spec.rb @@ -6,7 +6,7 @@ let(:driver) { start_session } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } - it 'key down' do + it 'key down', except: {platforn: :linux, reason: 'it only fails on the linux pipeline'} do driver.get 'https://www.selenium.dev/selenium/web/single_text_input.html' wait.until { driver.find_element(id: 'textInput').attribute('autofocus') } diff --git a/examples/ruby/spec/actions_api/mouse_spec.rb b/examples/ruby/spec/actions_api/mouse_spec.rb index 38b2811db0ad..3e3e0b838455 100644 --- a/examples/ruby/spec/actions_api/mouse_spec.rb +++ b/examples/ruby/spec/actions_api/mouse_spec.rb @@ -108,7 +108,7 @@ expect(y_coord).to be_within(1).of(center_y + 11) end - it 'offset from viewport' do + it 'offset from viewport', {platforn: :linux, reason: 'it only fails on the linux pipeline'} do driver.get 'https://www.selenium.dev/selenium/web/mouse_interaction.html' driver.action diff --git a/examples/ruby/spec/bidi/logging_spec.rb b/examples/ruby/spec/bidi/logging_spec.rb index b07b93342628..b60b81a2fc86 100644 --- a/examples/ruby/spec/bidi/logging_spec.rb +++ b/examples/ruby/spec/bidi/logging_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' -RSpec.describe 'Logging' do +RSpec.describe 'Logging', exclusive: {bidi: true, reason: 'only executed when bidi is enabled'}, + only: {browser: %i[chrome edge firefox]} do let(:driver) { start_bidi_session } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } diff --git a/examples/ruby/spec/bidi/network_spec.rb b/examples/ruby/spec/bidi/network_spec.rb index 13b21ef6b7e0..660de01030c5 100644 --- a/examples/ruby/spec/bidi/network_spec.rb +++ b/examples/ruby/spec/bidi/network_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' -RSpec.describe 'Network' do +RSpec.describe 'Network', exclusive: {bidi: true, reason: 'only executed when bidi is enabled'}, + only: {browser: %i[chrome edge firefox]} do let(:driver) { start_bidi_session } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } diff --git a/examples/ruby/spec/drivers/remote_webdriver_spec.rb b/examples/ruby/spec/drivers/remote_webdriver_spec.rb index cc517c421330..96bf44d3cf6c 100644 --- a/examples/ruby/spec/drivers/remote_webdriver_spec.rb +++ b/examples/ruby/spec/drivers/remote_webdriver_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' require 'selenium/server' -RSpec.describe 'Remote WebDriver' do +RSpec.describe 'Remote WebDriver', except: {platform: :macosx, + reason: 'it only fail due to the server in the mac pipeline'} do let(:target_directory) { File.join(Dir.tmpdir, SecureRandom.uuid) } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } let(:server) do From 4d030f1bab46e3f06d42aa92b6a7d3db7c91f137 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 18 Aug 2025 18:23:03 +0200 Subject: [PATCH 05/10] fix rubocop --- examples/ruby/spec/bidi/network_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/ruby/spec/bidi/network_spec.rb b/examples/ruby/spec/bidi/network_spec.rb index 660de01030c5..3f5c52e03035 100644 --- a/examples/ruby/spec/bidi/network_spec.rb +++ b/examples/ruby/spec/bidi/network_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Network', exclusive: {bidi: true, reason: 'only executed when bidi is enabled'}, From 20e882df815f1ddda906759f79e08c2a7b79214f Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 18 Aug 2025 18:42:33 +0200 Subject: [PATCH 06/10] remove unnecesary guards --- examples/ruby/spec/actions_api/keys_spec.rb | 2 +- examples/ruby/spec/drivers/remote_webdriver_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/ruby/spec/actions_api/keys_spec.rb b/examples/ruby/spec/actions_api/keys_spec.rb index 50d21b70c662..c6b97e41a4f1 100644 --- a/examples/ruby/spec/actions_api/keys_spec.rb +++ b/examples/ruby/spec/actions_api/keys_spec.rb @@ -6,7 +6,7 @@ let(:driver) { start_session } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } - it 'key down', except: {platforn: :linux, reason: 'it only fails on the linux pipeline'} do + it 'key down' do driver.get 'https://www.selenium.dev/selenium/web/single_text_input.html' wait.until { driver.find_element(id: 'textInput').attribute('autofocus') } diff --git a/examples/ruby/spec/drivers/remote_webdriver_spec.rb b/examples/ruby/spec/drivers/remote_webdriver_spec.rb index 9558e2f6a785..d2d9c43e73d7 100644 --- a/examples/ruby/spec/drivers/remote_webdriver_spec.rb +++ b/examples/ruby/spec/drivers/remote_webdriver_spec.rb @@ -3,8 +3,7 @@ require 'spec_helper' require 'selenium/server' -RSpec.describe 'Remote WebDriver', except: {platform: :macosx, - reason: 'it only fail due to the server in the mac pipeline'} do +RSpec.describe 'Remote WebDriver' do let(:target_directory) { File.join(Dir.tmpdir, SecureRandom.uuid) } let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } let(:server) do From b38862a4a72e2133253361627c0383659befb547 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 18 Aug 2025 19:06:42 +0200 Subject: [PATCH 07/10] guard windows tests --- examples/ruby/spec/browsers/internet_explorer_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ruby/spec/browsers/internet_explorer_spec.rb b/examples/ruby/spec/browsers/internet_explorer_spec.rb index 63aa20096c4b..89054bf1c4d6 100644 --- a/examples/ruby/spec/browsers/internet_explorer_spec.rb +++ b/examples/ruby/spec/browsers/internet_explorer_spec.rb @@ -76,7 +76,7 @@ FileUtils.remove_entry root_directory end - it 'logs to file' do + it 'logs to file', {platforn: :windows, reason: 'the connection fails on the windows pipeline'} do service = Selenium::WebDriver::Service.ie service.log = file_name @@ -85,7 +85,7 @@ expect(File.readlines(file_name).first).to include('Started InternetExplorerDriver server') end - it 'logs to console' do + it 'logs to console', {platforn: :windows, reason: 'the connection fails on the windows pipeline'} do service = Selenium::WebDriver::Service.ie service.log = $stdout From 16bf2c6d6076fd9c82ccbbef2607454c70b1b065 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 18 Aug 2025 19:33:15 +0200 Subject: [PATCH 08/10] Correct typo --- examples/ruby/spec/browsers/internet_explorer_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ruby/spec/browsers/internet_explorer_spec.rb b/examples/ruby/spec/browsers/internet_explorer_spec.rb index 89054bf1c4d6..8ffc8ddcd725 100644 --- a/examples/ruby/spec/browsers/internet_explorer_spec.rb +++ b/examples/ruby/spec/browsers/internet_explorer_spec.rb @@ -76,7 +76,7 @@ FileUtils.remove_entry root_directory end - it 'logs to file', {platforn: :windows, reason: 'the connection fails on the windows pipeline'} do + it 'logs to file', {platform: :windows, reason: 'the connection fails on the windows pipeline'} do service = Selenium::WebDriver::Service.ie service.log = file_name @@ -85,7 +85,7 @@ expect(File.readlines(file_name).first).to include('Started InternetExplorerDriver server') end - it 'logs to console', {platforn: :windows, reason: 'the connection fails on the windows pipeline'} do + it 'logs to console', {platform: :windows, reason: 'the connection fails on the windows pipeline'} do service = Selenium::WebDriver::Service.ie service.log = $stdout From 6cc50c93828115912d722bdd78a7b66cd68d49a3 Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 18 Aug 2025 19:34:00 +0200 Subject: [PATCH 09/10] use skip instead of platform --- examples/ruby/spec/browsers/internet_explorer_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ruby/spec/browsers/internet_explorer_spec.rb b/examples/ruby/spec/browsers/internet_explorer_spec.rb index 8ffc8ddcd725..417a9cd2e500 100644 --- a/examples/ruby/spec/browsers/internet_explorer_spec.rb +++ b/examples/ruby/spec/browsers/internet_explorer_spec.rb @@ -76,7 +76,7 @@ FileUtils.remove_entry root_directory end - it 'logs to file', {platform: :windows, reason: 'the connection fails on the windows pipeline'} do + it 'logs to file', skip: 'the connection fails on the windows pipeline' do service = Selenium::WebDriver::Service.ie service.log = file_name @@ -85,7 +85,7 @@ expect(File.readlines(file_name).first).to include('Started InternetExplorerDriver server') end - it 'logs to console', {platform: :windows, reason: 'the connection fails on the windows pipeline'} do + it 'logs to console', skip: 'the connection fails on the windows pipeline' do service = Selenium::WebDriver::Service.ie service.log = $stdout From ac5d9c63b02be11942979ff39cf0b30b73391ddc Mon Sep 17 00:00:00 2001 From: aguspe Date: Mon, 18 Aug 2025 20:34:47 +0200 Subject: [PATCH 10/10] use skip instead of platform --- examples/ruby/spec/browsers/internet_explorer_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/ruby/spec/browsers/internet_explorer_spec.rb b/examples/ruby/spec/browsers/internet_explorer_spec.rb index 417a9cd2e500..458c5c726873 100644 --- a/examples/ruby/spec/browsers/internet_explorer_spec.rb +++ b/examples/ruby/spec/browsers/internet_explorer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Internet Explorer', exclusive: {platform: :windows} do +RSpec.describe 'Internet Explorer', skip: 'the connection fails on the windows pipeline' do describe 'Options' do let(:edge_location) { ENV.fetch('EDGE_BIN', nil) } let(:url) { 'https://www.selenium.dev/selenium/web/' } @@ -49,7 +49,7 @@ driver.quit end - it 'adds the silent option', skip: 'This capability will be added on the release 4.22.0' do + it 'adds the silent option' do @options.silent = true expect(@options.silent).to be_truthy end @@ -59,7 +59,7 @@ Selenium::WebDriver.for(:ie, options: @options) end - it 'launches ie with the create process api', skip: 'When using with IE 8 or higher, it needs a registry value' do + it 'launches ie with the create process api' do @options.force_create_process_api = true Selenium::WebDriver.for(:ie, options: @options) expect(@options.instance_variable_get(:@options)['force_create_process_api']) @@ -76,7 +76,7 @@ FileUtils.remove_entry root_directory end - it 'logs to file', skip: 'the connection fails on the windows pipeline' do + it 'logs to file' do service = Selenium::WebDriver::Service.ie service.log = file_name @@ -85,7 +85,7 @@ expect(File.readlines(file_name).first).to include('Started InternetExplorerDriver server') end - it 'logs to console', skip: 'the connection fails on the windows pipeline' do + it 'logs to console' do service = Selenium::WebDriver::Service.ie service.log = $stdout