Skip to content
39 changes: 39 additions & 0 deletions examples/ruby/spec/bidi/network_spec.rb
Original file line number Diff line number Diff line change
@@ -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', 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
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -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 >}}
101 changes: 100 additions & 1 deletion website_and_docs/content/documentation/webdriver/bidi/network.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
---
Expand All @@ -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 >}}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
---
Expand All @@ -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 >}}
Loading
Loading