Skip to content

Commit 49af31b

Browse files
committed
Expand options documentation test and examples
1 parent 1196cf2 commit 49af31b

File tree

5 files changed

+65
-42
lines changed

5 files changed

+65
-42
lines changed

Diff for: examples/ruby/spec/drivers/options_spec.rb

+45
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,50 @@
4545
driver.get('https://www.google.com')
4646
driver.quit
4747
end
48+
49+
it 'accepts untrusted certificates' do
50+
options = Selenium::WebDriver::Options.chrome
51+
options.accept_insecure_certs = true
52+
53+
driver = Selenium::WebDriver.for :chrome, options: options
54+
driver.get('https://expired.badssl.com/')
55+
driver.quit
56+
end
57+
58+
it 'sets unhandled prompt behavior' do
59+
options = Selenium::WebDriver::Options.chrome
60+
options.unhandled_prompt_behavior = :accept
61+
62+
driver = Selenium::WebDriver.for :chrome, options: options
63+
driver.get('https://www.google.com')
64+
driver.quit
65+
end
66+
67+
it 'sets window rect' do
68+
options = Selenium::WebDriver::Options.firefox
69+
options.set_window_rect = true
70+
71+
driver = Selenium::WebDriver.for :firefox, options: options
72+
driver.get('https://www.google.com')
73+
driver.quit
74+
end
75+
76+
it 'sets strict file interactability' do
77+
options = Selenium::WebDriver::Options.chrome
78+
options.strict_file_interactability = true
79+
80+
driver = Selenium::WebDriver.for :chrome, options: options
81+
driver.get('https://www.google.com')
82+
driver.quit
83+
end
84+
85+
it 'sets the proxy' do
86+
options = Selenium::WebDriver::Options.chrome
87+
options.proxy = Selenium::WebDriver::Proxy.new(http: 'myproxy.com:8080')
88+
89+
driver = Selenium::WebDriver.for :chrome, options: options
90+
driver.get('https://www.google.com')
91+
driver.quit
92+
end
4893
end
4994
end

Diff for: website_and_docs/content/documentation/webdriver/drivers/options.en.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ effect for the entire session.
334334
{{< badge-code >}}
335335
{{< /tab >}}
336336
{{< tab header="Ruby" >}}
337-
{{< badge-code >}}
337+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L50-L51" >}}
338338
{{< /tab >}}
339339
{{< tab header="JavaScript" >}}
340340
{{< badge-code >}}
@@ -463,7 +463,7 @@ user prompt encounters at the remote-end. This is defined by
463463
{{< badge-code >}}
464464
{{< /tab >}}
465465
{{< tab header="Ruby" >}}
466-
{{< badge-code >}}
466+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L59-L60" >}}
467467
{{< /tab >}}
468468
{{< tab header="JavaScript" >}}
469469
{{< badge-code >}}
@@ -488,7 +488,7 @@ Indicates whether the remote end supports all of the [resizing and repositioning
488488
{{< badge-code >}}
489489
{{< /tab >}}
490490
{{< tab header="Ruby" >}}
491-
{{< badge-code >}}
491+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L68-L69" >}}
492492
{{< /tab >}}
493493
{{< tab header="JavaScript" >}}
494494
{{< badge-code >}}
@@ -516,7 +516,7 @@ when using _Element Send Keys_ with hidden file upload controls.
516516
{{< badge-code >}}
517517
{{< /tab >}}
518518
{{< tab header="Ruby" >}}
519-
{{< badge-code >}}
519+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L77-L78" >}}
520520
{{< /tab >}}
521521
{{< tab header="JavaScript" >}}
522522
{{< badge-code >}}
@@ -603,12 +603,7 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/");
603603
}
604604
{{< /tab >}}
605605
{{< tab header="Ruby" >}}
606-
607-
proxy = Selenium::WebDriver::Proxy.new(http: '<HOST:PORT>')
608-
cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
609-
610-
driver = Selenium::WebDriver.for(:chrome, capabilities: cap)
611-
driver.get('http://google.com')
606+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L86-L87" >}}
612607
{{< /tab >}}
613608
{{< tab header="JavaScript" >}}
614609
let webdriver = require('selenium-webdriver');

Diff for: website_and_docs/content/documentation/webdriver/drivers/options.ja.md

+5-11
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ fun main() {
322322
{{< badge-code >}}
323323
{{< /tab >}}
324324
{{< tab header="Ruby" >}}
325-
{{< badge-code >}}
325+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L50-L51" >}}
326326
{{< /tab >}}
327327
{{< tab header="JavaScript" >}}
328328
{{< badge-code >}}
@@ -442,7 +442,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ
442442
{{< badge-code >}}
443443
{{< /tab >}}
444444
{{< tab header="Ruby" >}}
445-
{{< badge-code >}}
445+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L59-L60" >}}
446446
{{< /tab >}}
447447
{{< tab header="JavaScript" >}}
448448
{{< badge-code >}}
@@ -468,7 +468,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ
468468
{{< badge-code >}}
469469
{{< /tab >}}
470470
{{< tab header="Ruby" >}}
471-
{{< badge-code >}}
471+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L68-L69" >}}
472472
{{< /tab >}}
473473
{{< tab header="JavaScript" >}}
474474
{{< badge-code >}}
@@ -495,7 +495,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ
495495
{{< badge-code >}}
496496
{{< /tab >}}
497497
{{< tab header="Ruby" >}}
498-
{{< badge-code >}}
498+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L77-L78" >}}
499499
{{< /tab >}}
500500
{{< tab header="JavaScript" >}}
501501
{{< badge-code >}}
@@ -577,13 +577,7 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/");
577577
}
578578
{{< /tab >}}
579579
{{< tab header="Ruby" >}}
580-
# this code was written with Selenium 4
581-
582-
proxy = Selenium::WebDriver::Proxy.new(http: '<HOST:PORT>')
583-
cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
584-
585-
driver = Selenium::WebDriver.for(:chrome, capabilities: cap)
586-
driver.get('http://google.com')
580+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L86-L87" >}}
587581
{{< /tab >}}
588582
{{< tab header="JavaScript" >}}
589583
let webdriver = require('selenium-webdriver');

Diff for: website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ effect for the entire session.
345345
{{< badge-code >}}
346346
{{< /tab >}}
347347
{{< tab header="Ruby" >}}
348-
{{< badge-code >}}
348+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L50-L51" >}}
349349
{{< /tab >}}
350350
{{< tab header="JavaScript" >}}
351351
{{< badge-code >}}
@@ -476,7 +476,7 @@ user prompt encounters at the remote-end. This is defined by
476476
{{< badge-code >}}
477477
{{< /tab >}}
478478
{{< tab header="Ruby" >}}
479-
{{< badge-code >}}
479+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L59-L60" >}}
480480
{{< /tab >}}
481481
{{< tab header="JavaScript" >}}
482482
{{< badge-code >}}
@@ -502,7 +502,7 @@ Indicates whether the remote end supports all of the [resizing and repositioning
502502
{{< badge-code >}}
503503
{{< /tab >}}
504504
{{< tab header="Ruby" >}}
505-
{{< badge-code >}}
505+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L68-L69" >}}
506506
{{< /tab >}}
507507
{{< tab header="JavaScript" >}}
508508
{{< badge-code >}}
@@ -531,7 +531,7 @@ when using _Element Send Keys_ with hidden file upload controls.
531531
{{< badge-code >}}
532532
{{< /tab >}}
533533
{{< tab header="Ruby" >}}
534-
{{< badge-code >}}
534+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L77-L78" >}}
535535
{{< /tab >}}
536536
{{< tab header="JavaScript" >}}
537537
{{< badge-code >}}
@@ -618,12 +618,7 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/");
618618
}
619619
{{< /tab >}}
620620
{{< tab header="Ruby" >}}
621-
622-
proxy = Selenium::WebDriver::Proxy.new(http: '<HOST:PORT>')
623-
cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
624-
625-
driver = Selenium::WebDriver.for(:chrome, capabilities: cap)
626-
driver.get('http://google.com')
621+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L86-L87" >}}
627622
{{< /tab >}}
628623
{{< tab header="JavaScript" >}}
629624
let webdriver = require('selenium-webdriver');

Diff for: website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md

+5-11
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ fun main() {
337337
{{< badge-code >}}
338338
{{< /tab >}}
339339
{{< tab header="Ruby" >}}
340-
{{< badge-code >}}
340+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L50-L51" >}}
341341
{{< /tab >}}
342342
{{< tab header="JavaScript" >}}
343343
{{< badge-code >}}
@@ -465,7 +465,7 @@ WebDriver创建新会话时,
465465
{{< badge-code >}}
466466
{{< /tab >}}
467467
{{< tab header="Ruby" >}}
468-
{{< badge-code >}}
468+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L59-L60" >}}
469469
{{< /tab >}}
470470
{{< tab header="JavaScript" >}}
471471
{{< badge-code >}}
@@ -492,7 +492,7 @@ WebDriver创建新会话时,
492492
{{< badge-code >}}
493493
{{< /tab >}}
494494
{{< tab header="Ruby" >}}
495-
{{< badge-code >}}
495+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L68-L69" >}}
496496
{{< /tab >}}
497497
{{< tab header="JavaScript" >}}
498498
{{< badge-code >}}
@@ -521,7 +521,7 @@ WebDriver创建新会话时,
521521
{{< badge-code >}}
522522
{{< /tab >}}
523523
{{< tab header="Ruby" >}}
524-
{{< badge-code >}}
524+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L77-L78" >}}
525525
{{< /tab >}}
526526
{{< tab header="JavaScript" >}}
527527
{{< badge-code >}}
@@ -606,13 +606,7 @@ driver.Navigate().GoToUrl("https://www.selenium.dev/");
606606
}
607607
{{< /tab >}}
608608
{{< tab header="Ruby" >}}
609-
# this code was written with Selenium 4
610-
611-
proxy = Selenium::WebDriver::Proxy.new(http: '<HOST:PORT>')
612-
cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
613-
614-
driver = Selenium::WebDriver.for(:chrome, capabilities: cap)
615-
driver.get('http://google.com')
609+
{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L86-L87" >}}
616610
{{< /tab >}}
617611
{{< tab header="JavaScript" >}}
618612
let webdriver = require('selenium-webdriver');

0 commit comments

Comments
 (0)