Skip to content

Commit 201a257

Browse files
authored
Add BiDi network examples and documentation for Ruby (#2100)
* Add BiDi network examples and documentation for Ruby * Add skips until new Selenium release * Fix tests * Add guards * fix rubocop * remove unnecesary guards * guard windows tests * Correct typo * use skip instead of platform * use skip instead of platform
1 parent b99b7e3 commit 201a257

File tree

7 files changed

+402
-7
lines changed

7 files changed

+402
-7
lines changed

examples/ruby/spec/actions_api/mouse_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
expect(y_coord).to be_within(1).of(center_y + 11)
109109
end
110110

111-
it 'offset from viewport' do
111+
it 'offset from viewport', {platforn: :linux, reason: 'it only fails on the linux pipeline'} do
112112
driver.get 'https://www.selenium.dev/selenium/web/mouse_interaction.html'
113113

114114
driver.action
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
RSpec.describe 'Network', exclusive: {bidi: true, reason: 'only executed when bidi is enabled'},
6+
only: {browser: %i[chrome edge firefox]} do
7+
let(:driver) { start_bidi_session }
8+
let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) }
9+
10+
it 'adds an auth handler', skip: 'Do not execute BiDi test' do
11+
driver.network.add_authentication_handler('test', 'test')
12+
driver.navigate.to url_for('basicAuth')
13+
expect(driver.find_element(tag_name: 'h1').text).to eq('authorized')
14+
end
15+
end

examples/ruby/spec/browsers/internet_explorer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'spec_helper'
44

5-
RSpec.describe 'Internet Explorer', exclusive: {platform: :windows} do
5+
RSpec.describe 'Internet Explorer', skip: 'the connection fails on the windows pipeline' do
66
describe 'Options' do
77
let(:edge_location) { ENV.fetch('EDGE_BIN', nil) }
88
let(:url) { 'https://www.selenium.dev/selenium/web/' }
@@ -49,7 +49,7 @@
4949
driver.quit
5050
end
5151

52-
it 'adds the silent option', skip: 'This capability will be added on the release 4.22.0' do
52+
it 'adds the silent option' do
5353
@options.silent = true
5454
expect(@options.silent).to be_truthy
5555
end
@@ -59,7 +59,7 @@
5959
Selenium::WebDriver.for(:ie, options: @options)
6060
end
6161

62-
it 'launches ie with the create process api', skip: 'When using with IE 8 or higher, it needs a registry value' do
62+
it 'launches ie with the create process api' do
6363
@options.force_create_process_api = true
6464
Selenium::WebDriver.for(:ie, options: @options)
6565
expect(@options.instance_variable_get(:@options)['force_create_process_api'])

website_and_docs/content/documentation/webdriver/bidi/network.en.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,101 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}})
1717

1818
## Authentication Handlers
1919

20+
Authentication handlers enable you to intercept authentication requests that occur during a network interaction.
21+
These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth.
22+
They allow you to programmatically provide credentials or modify the authentication flow.
23+
24+
### Add Handler
25+
26+
{{< tabpane text=true >}}
27+
{{< tab header="Java" >}}
28+
{{< /tab >}}
29+
{{< tab header="Python" >}}
30+
{{< /tab >}}
31+
{{< tab header="CSharp" >}}
32+
{{< /tab >}}
33+
{{< tab header="Ruby" >}}
34+
{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}}
35+
{{< /tab >}}
36+
{{< tab header="JavaScript" >}}
37+
{{< /tab >}}
38+
{{< tab header="Kotlin" >}}
39+
{{< /tab >}}
40+
{{< /tabpane >}}
41+
2042
## Request Handlers
2143

44+
Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server.
45+
This can be used to modify request headers, change the request body, or block specific requests.
46+
Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic.
47+
48+
### Add Handler
49+
50+
{{< tabpane text=true >}}
51+
{{< tab header="Java" >}}
52+
{{< /tab >}}
53+
{{< tab header="Python" >}}
54+
{{< /tab >}}
55+
{{< tab header="CSharp" >}}
56+
{{< /tab >}}
57+
{{< tab header="Ruby" >}}
58+
{{< /tab >}}
59+
{{< tab header="JavaScript" >}}
60+
{{< /tab >}}
61+
{{< tab header="Kotlin" >}}
62+
{{< /tab >}}
63+
{{< /tabpane >}}
64+
2265
## Response Handlers
66+
67+
Response handlers enable you to intercept and manipulate incoming responses from the server.
68+
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.
69+
70+
{{< tabpane text=true >}}
71+
{{< tab header="Java" >}}
72+
{{< /tab >}}
73+
{{< tab header="Python" >}}
74+
{{< /tab >}}
75+
{{< tab header="CSharp" >}}
76+
{{< /tab >}}
77+
{{< tab header="Ruby" >}}
78+
{{< /tab >}}
79+
{{< tab header="JavaScript" >}}
80+
{{< /tab >}}
81+
{{< tab header="Kotlin" >}}
82+
{{< /tab >}}
83+
{{< /tabpane >}}
84+
85+
## Remove Handler
86+
87+
{{< tabpane text=true >}}
88+
{{< tab header="Java" >}}
89+
{{< /tab >}}
90+
{{< tab header="Python" >}}
91+
{{< /tab >}}
92+
{{< tab header="CSharp" >}}
93+
{{< /tab >}}
94+
{{< tab header="Ruby" >}}
95+
{{< /tab >}}
96+
{{< tab header="JavaScript" >}}
97+
{{< /tab >}}
98+
{{< tab header="Kotlin" >}}
99+
{{< /tab >}}
100+
{{< /tabpane >}}
101+
102+
## Clear Handlers
103+
104+
{{< tabpane text=true >}}
105+
{{< tab header="Java" >}}
106+
{{< /tab >}}
107+
{{< tab header="Python" >}}
108+
{{< /tab >}}
109+
{{< tab header="CSharp" >}}
110+
{{< /tab >}}
111+
{{< tab header="Ruby" >}}
112+
{{< /tab >}}
113+
{{< tab header="JavaScript" >}}
114+
{{< /tab >}}
115+
{{< tab header="Kotlin" >}}
116+
{{< /tab >}}
117+
{{< /tabpane >}}

website_and_docs/content/documentation/webdriver/bidi/network.ja.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ weight: 1
55
description: >
66
These features are related to networking, and are made available via a "network" namespace.
77
aliases: [
8-
"/documentation/ja/webdriver/bidirectional/bidirectional_w3c/network",
8+
"/documentation/en/webdriver/bidirectional/bidirectional_w3c/network",
99
"/documentation/webdriver/bidirectional/webdriver_bidi/network"
1010
]
1111
---
@@ -17,6 +17,101 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}})
1717

1818
## Authentication Handlers
1919

20+
Authentication handlers enable you to intercept authentication requests that occur during a network interaction.
21+
These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth.
22+
They allow you to programmatically provide credentials or modify the authentication flow.
23+
24+
### Add Handler
25+
26+
{{< tabpane text=true >}}
27+
{{< tab header="Java" >}}
28+
{{< /tab >}}
29+
{{< tab header="Python" >}}
30+
{{< /tab >}}
31+
{{< tab header="CSharp" >}}
32+
{{< /tab >}}
33+
{{< tab header="Ruby" >}}
34+
{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}}
35+
{{< /tab >}}
36+
{{< tab header="JavaScript" >}}
37+
{{< /tab >}}
38+
{{< tab header="Kotlin" >}}
39+
{{< /tab >}}
40+
{{< /tabpane >}}
41+
2042
## Request Handlers
2143

44+
Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server.
45+
This can be used to modify request headers, change the request body, or block specific requests.
46+
Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic.
47+
48+
### Add Handler
49+
50+
{{< tabpane text=true >}}
51+
{{< tab header="Java" >}}
52+
{{< /tab >}}
53+
{{< tab header="Python" >}}
54+
{{< /tab >}}
55+
{{< tab header="CSharp" >}}
56+
{{< /tab >}}
57+
{{< tab header="Ruby" >}}
58+
{{< /tab >}}
59+
{{< tab header="JavaScript" >}}
60+
{{< /tab >}}
61+
{{< tab header="Kotlin" >}}
62+
{{< /tab >}}
63+
{{< /tabpane >}}
64+
2265
## Response Handlers
66+
67+
Response handlers enable you to intercept and manipulate incoming responses from the server.
68+
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.
69+
70+
{{< tabpane text=true >}}
71+
{{< tab header="Java" >}}
72+
{{< /tab >}}
73+
{{< tab header="Python" >}}
74+
{{< /tab >}}
75+
{{< tab header="CSharp" >}}
76+
{{< /tab >}}
77+
{{< tab header="Ruby" >}}
78+
{{< /tab >}}
79+
{{< tab header="JavaScript" >}}
80+
{{< /tab >}}
81+
{{< tab header="Kotlin" >}}
82+
{{< /tab >}}
83+
{{< /tabpane >}}
84+
85+
## Remove Handler
86+
87+
{{< tabpane text=true >}}
88+
{{< tab header="Java" >}}
89+
{{< /tab >}}
90+
{{< tab header="Python" >}}
91+
{{< /tab >}}
92+
{{< tab header="CSharp" >}}
93+
{{< /tab >}}
94+
{{< tab header="Ruby" >}}
95+
{{< /tab >}}
96+
{{< tab header="JavaScript" >}}
97+
{{< /tab >}}
98+
{{< tab header="Kotlin" >}}
99+
{{< /tab >}}
100+
{{< /tabpane >}}
101+
102+
## Clear Handlers
103+
104+
{{< tabpane text=true >}}
105+
{{< tab header="Java" >}}
106+
{{< /tab >}}
107+
{{< tab header="Python" >}}
108+
{{< /tab >}}
109+
{{< tab header="CSharp" >}}
110+
{{< /tab >}}
111+
{{< tab header="Ruby" >}}
112+
{{< /tab >}}
113+
{{< tab header="JavaScript" >}}
114+
{{< /tab >}}
115+
{{< tab header="Kotlin" >}}
116+
{{< /tab >}}
117+
{{< /tabpane >}}

website_and_docs/content/documentation/webdriver/bidi/network.pt-br.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ weight: 1
55
description: >
66
These features are related to networking, and are made available via a "network" namespace.
77
aliases: [
8-
"/documentation/pt-br/webdriver/bidirectional/bidirectional_w3c/network",
8+
"/documentation/en/webdriver/bidirectional/bidirectional_w3c/network",
99
"/documentation/webdriver/bidirectional/webdriver_bidi/network"
1010
]
1111
---
@@ -17,6 +17,101 @@ For more details, see [Enabling BiDi]({{< ref "BiDi" >}})
1717

1818
## Authentication Handlers
1919

20+
Authentication handlers enable you to intercept authentication requests that occur during a network interaction.
21+
These handlers are useful for automating scenarios involving authentication prompts, such as Basic Auth or Digest Auth.
22+
They allow you to programmatically provide credentials or modify the authentication flow.
23+
24+
### Add Handler
25+
26+
{{< tabpane text=true >}}
27+
{{< tab header="Java" >}}
28+
{{< /tab >}}
29+
{{< tab header="Python" >}}
30+
{{< /tab >}}
31+
{{< tab header="CSharp" >}}
32+
{{< /tab >}}
33+
{{< tab header="Ruby" >}}
34+
{{< gh-codeblock path="examples/ruby/spec/bidi/network_spec.rb#L7-L11" >}}
35+
{{< /tab >}}
36+
{{< tab header="JavaScript" >}}
37+
{{< /tab >}}
38+
{{< tab header="Kotlin" >}}
39+
{{< /tab >}}
40+
{{< /tabpane >}}
41+
2042
## Request Handlers
2143

44+
Request handlers allow you to intercept and manipulate outgoing network requests before they are sent to the server.
45+
This can be used to modify request headers, change the request body, or block specific requests.
46+
Request handlers are essential for testing and debugging scenarios where you need control over outgoing traffic.
47+
48+
### Add Handler
49+
50+
{{< tabpane text=true >}}
51+
{{< tab header="Java" >}}
52+
{{< /tab >}}
53+
{{< tab header="Python" >}}
54+
{{< /tab >}}
55+
{{< tab header="CSharp" >}}
56+
{{< /tab >}}
57+
{{< tab header="Ruby" >}}
58+
{{< /tab >}}
59+
{{< tab header="JavaScript" >}}
60+
{{< /tab >}}
61+
{{< tab header="Kotlin" >}}
62+
{{< /tab >}}
63+
{{< /tabpane >}}
64+
2265
## Response Handlers
66+
67+
Response handlers enable you to intercept and manipulate incoming responses from the server.
68+
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.
69+
70+
{{< tabpane text=true >}}
71+
{{< tab header="Java" >}}
72+
{{< /tab >}}
73+
{{< tab header="Python" >}}
74+
{{< /tab >}}
75+
{{< tab header="CSharp" >}}
76+
{{< /tab >}}
77+
{{< tab header="Ruby" >}}
78+
{{< /tab >}}
79+
{{< tab header="JavaScript" >}}
80+
{{< /tab >}}
81+
{{< tab header="Kotlin" >}}
82+
{{< /tab >}}
83+
{{< /tabpane >}}
84+
85+
## Remove Handler
86+
87+
{{< tabpane text=true >}}
88+
{{< tab header="Java" >}}
89+
{{< /tab >}}
90+
{{< tab header="Python" >}}
91+
{{< /tab >}}
92+
{{< tab header="CSharp" >}}
93+
{{< /tab >}}
94+
{{< tab header="Ruby" >}}
95+
{{< /tab >}}
96+
{{< tab header="JavaScript" >}}
97+
{{< /tab >}}
98+
{{< tab header="Kotlin" >}}
99+
{{< /tab >}}
100+
{{< /tabpane >}}
101+
102+
## Clear Handlers
103+
104+
{{< tabpane text=true >}}
105+
{{< tab header="Java" >}}
106+
{{< /tab >}}
107+
{{< tab header="Python" >}}
108+
{{< /tab >}}
109+
{{< tab header="CSharp" >}}
110+
{{< /tab >}}
111+
{{< tab header="Ruby" >}}
112+
{{< /tab >}}
113+
{{< tab header="JavaScript" >}}
114+
{{< /tab >}}
115+
{{< tab header="Kotlin" >}}
116+
{{< /tab >}}
117+
{{< /tabpane >}}

0 commit comments

Comments
 (0)