From bee73075b4da873829663bbe50c77821a5440453 Mon Sep 17 00:00:00 2001
From: Augustin Pequeno <augustin.gottlieb@merkle.com>
Date: Sat, 14 Dec 2024 16:17:26 +0100
Subject: [PATCH 1/4] 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 <augustin.gottlieb@merkle.com>
Date: Sat, 14 Dec 2024 16:22:14 +0100
Subject: [PATCH 2/4] 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 <agustin.pe94@gmail.com>
Date: Sat, 22 Mar 2025 15:03:07 +0100
Subject: [PATCH 3/4] 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 <agustin.pe94@gmail.com>
Date: Sat, 22 Mar 2025 16:40:44 +0100
Subject: [PATCH 4/4] 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