Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 69a9183

Browse files
aguspeharsha509
andauthored
Migrate and update ruby code examples with internet explorer (#1748)[deploy site]
* Migrate code to examples * Finish code migration * Refactor code migration * Update examples * Update silent options * Update silent options --------- Co-authored-by: aguspe <agustin.pe94@gmail.com> Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com>
1 parent 564c2ec commit 69a9183

File tree

5 files changed

+152
-222
lines changed

5 files changed

+152
-222
lines changed

‎examples/ruby/spec/browsers/internet_explorer_spec.rb‎

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
RSpec.describe 'Internet Explorer', exclusive: {platform: :windows} do
66
describe 'Options' do
77
let(:edge_location) { ENV.fetch('EDGE_BIN', nil) }
8+
let(:url) { 'https://www.selenium.dev/selenium/web/' }
9+
10+
before do
11+
@options = Selenium::WebDriver::IE::Options.new
12+
@options.attach_to_edge_chrome = true
13+
@options.edge_executable_path = edge_location
14+
end
815

916
it 'basic options Win10' do
10-
options = Selenium::WebDriver::Options.ie
17+
options = Selenium::WebDriver::IE::Options.new
1118
options.attach_to_edge_chrome = true
1219
options.edge_executable_path = edge_location
1320
@driver = Selenium::WebDriver.for :ie, options: options
@@ -17,6 +24,47 @@
1724
options = Selenium::WebDriver::Options.ie
1825
@driver = Selenium::WebDriver.for :ie, options: options
1926
end
27+
28+
it 'sets the file upload dialog timeout' do
29+
@options.file_upload_dialog_timeout = 2000
30+
driver = Selenium::WebDriver.for(:ie, options: @options)
31+
driver.quit
32+
end
33+
34+
it 'ensures a clean session' do
35+
@options.ensure_clean_session = true
36+
driver = Selenium::WebDriver.for(:ie, options: @options)
37+
driver.quit
38+
end
39+
40+
it 'ignores the zoom setting' do
41+
@options.ignore_zoom_level = true
42+
driver = Selenium::WebDriver.for(:ie, options: @options)
43+
driver.quit
44+
end
45+
46+
it 'ignores the protected mode settings' do
47+
@options.ignore_protected_mode_settings = true
48+
driver = Selenium::WebDriver.for(:ie, options: @options)
49+
driver.quit
50+
end
51+
52+
it 'adds the silent option', skip: 'This capability will be added on the release 4.22.0' do
53+
@options.silent = true
54+
expect(@options.silent).to be_truthy
55+
end
56+
57+
it 'sets the command line options' do
58+
@options.add_argument('-k')
59+
Selenium::WebDriver.for(:ie, options: @options)
60+
end
61+
62+
it 'launches ie with the create process api', skip: 'When using with IE 8 or higher, it needs a registry value' do
63+
@options.force_create_process_api = true
64+
Selenium::WebDriver.for(:ie, options: @options)
65+
expect(@options.instance_variable_get(:@options)['force_create_process_api'])
66+
.to eq({force_create_process_api: true})
67+
end
2068
end
2169

2270
describe 'Service' do

‎website_and_docs/content/documentation/webdriver/browsers/internet_explorer.en.md‎

Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Starting a Microsoft Edge browser in Internet Explorer Compatibility mode with b
3838
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L35-L38" >}}
3939
{{% /tab %}}
4040
{{< tab header="Ruby" >}}
41-
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L10-L13" >}}
41+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L17-L20" >}}
4242
{{< /tab >}}
4343
{{< tab header="JavaScript" >}}
4444
{{< badge-code >}}
@@ -68,7 +68,7 @@ So, if IE is not on the system, you only need:
6868
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L44-L45" >}}
6969
{{% /tab %}}
7070
{{< tab header="Ruby" text=true >}}
71-
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L17-L18" >}}
71+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L24-L25" >}}
7272
{{< /tab >}}
7373
{{< tab header="JavaScript" >}}
7474
let driver = await new Builder()
@@ -113,10 +113,8 @@ var options = new InternetExplorerOptions();
113113
options.FileUploadDialogTimeout = TimeSpan.FromMilliseconds(2000);
114114
var driver = new RemoteWebDriver(options);
115115
{{< /tab >}}
116-
{{< tab header="Ruby" >}}
117-
options = Selenium::WebDriver::IE::Options.new
118-
options.file_upload_dialog_timeout = 2000
119-
driver = Selenium::WebDriver.for(:ie, options: options)
116+
{{< tab header="Ruby" text=true >}}
117+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L29-L30" >}}
120118
{{< /tab >}}
121119
{{< tab header="JavaScript" >}}
122120
const ie = require('selenium-webdriver/ie');
@@ -168,10 +166,8 @@ var options = new InternetExplorerOptions();
168166
options.EnsureCleanSession = true;
169167
var driver = new RemoteWebDriver(options);
170168
{{< /tab >}}
171-
{{< tab header="Ruby" >}}
172-
options = Selenium::WebDriver::IE::Options.new
173-
options.ensure_clean_session = true
174-
driver = Selenium::WebDriver.for(:ie, options: options)
169+
{{< tab header="Ruby" text=true >}}
170+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L35-L36" >}}
175171
{{< /tab >}}
176172
{{< tab header="JavaScript" >}}
177173
const ie = require('selenium-webdriver/ie');
@@ -218,11 +214,9 @@ var options = new InternetExplorerOptions();
218214
options.IgnoreZoomLevel = true;
219215
var driver = new RemoteWebDriver(options);
220216
{{< /tab >}}
221-
{{< tab header="Ruby" >}}
222-
options = Selenium::WebDriver::IE::Options.new
223-
options.ignore_zoom_level = true
224-
driver = Selenium::WebDriver.for(:ie, options: options)
225-
{{< /tab >}}
217+
{{< tab header="Ruby" text=true >}}
218+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L41-L42" >}}
219+
{{< /tab >}}
226220
{{< tab header="JavaScript" >}}
227221
const ie = require('selenium-webdriver/ie');
228222
let options = new ie.Options().ignoreZoomSetting(true);
@@ -278,11 +272,9 @@ var options = new InternetExplorerOptions();
278272
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
279273
var driver = new RemoteWebDriver(options);
280274
{{< /tab >}}
281-
{{< tab header="Ruby" >}}
282-
options = Selenium::WebDriver::IE::Options.new
283-
options.ignore_protected_mode_settings = true
284-
driver = Selenium::WebDriver.for(:ie, options: options)
285-
{{< /tab >}}
275+
{{< tab header="Ruby" text=true >}}
276+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L47-L48" >}}
277+
{{< /tab >}}
286278
{{< tab header="JavaScript" >}}
287279
const ie = require('selenium-webdriver/ie');
288280
let options = new ie.Options().introduceFlakinessByIgnoringProtectedModeSettings(true);
@@ -327,9 +319,9 @@ InternetExplorerOptions options = new InternetExplorerOptions();
327319
options.AddAdditionalInternetExplorerOption("silent", true);
328320
IWebDriver driver = new InternetExplorerDriver(options);
329321
{{< /tab >}}
330-
{{< tab header="Ruby" >}}
331-
{{< badge-code >}}
332-
{{< /tab >}}
322+
{{< tab header="Ruby" text=true >}}
323+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L53-L54" >}}
324+
{{< /tab >}}
333325
{{< tab header="JavaScript" >}}
334326
const {Builder,By, Capabilities} = require('selenium-webdriver');
335327
let caps = Capabilities.ie();
@@ -437,20 +429,9 @@ namespace ieTest {
437429
}
438430
}
439431
{{< /tab >}}
440-
{{< tab header="Ruby" >}}
441-
require 'selenium-webdriver'
442-
options = Selenium::WebDriver::IE::Options.new
443-
options.force_create_process_api = true
444-
options.add_argument('-k')
445-
driver = Selenium::WebDriver.for(:ie, options: options)
446-
447-
begin
448-
driver.get 'https://google.com'
449-
puts(driver.capabilities.to_json)
450-
ensure
451-
driver.quit
452-
end
453-
{{< /tab >}}
432+
{{< tab header="Ruby" text=true >}}
433+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L59-L60" >}}
434+
{{< /tab >}}
454435
{{< tab header="JavaScript" >}}
455436
const ie = require('selenium-webdriver/ie');
456437
let options = new ie.Options();
@@ -541,19 +522,9 @@ namespace ieTest {
541522
}
542523
}
543524
{{< /tab >}}
544-
{{< tab header="Ruby" >}}
545-
require 'selenium-webdriver'
546-
options = Selenium::WebDriver::IE::Options.new
547-
options.force_create_process_api = true
548-
driver = Selenium::WebDriver.for(:ie, options: options)
549-
550-
begin
551-
driver.get 'https://google.com'
552-
puts(driver.capabilities.to_json)
553-
ensure
554-
driver.quit
555-
end
556-
{{< /tab >}}
525+
{{< tab header="Ruby" text=true >}}
526+
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L64-L65" >}}
527+
{{< /tab >}}
557528
{{< tab header="JavaScript" >}}
558529
const ie = require('selenium-webdriver/ie');
559530
let options = new ie.Options();
@@ -612,7 +583,7 @@ Property value: String representing path to log file
612583
{{< /tab >}}
613584
{{< tab header="Ruby" >}}
614585
{{< badge-version version="4.10" >}}
615-
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L34" >}}
586+
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L83" >}}
616587
{{< /tab >}}
617588
{{< tab header="JavaScript" >}}
618589
{{< badge-code >}}
@@ -643,7 +614,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
643614
{{< /tab >}}
644615
{{< tab header="Ruby" >}}
645616
{{< badge-version version="4.10" >}}
646-
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L43" >}}
617+
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L101" >}}
647618
{{< /tab >}}
648619
{{< tab header="JavaScript" >}}
649620
{{< badge-code >}}
@@ -672,7 +643,7 @@ Property value: String representation of `InternetExplorerDriverLogLevel.DEBUG.t
672643
{{< /tab >}}
673644
{{< tab header="Ruby" >}}
674645
{{< badge-version version="4.10" >}}
675-
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L54" >}}
646+
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L103" >}}
676647
{{< /tab >}}
677648
{{< tab header="JavaScript" >}}
678649
{{< badge-code >}}
@@ -700,7 +671,7 @@ Property value: String representing path to supporting files directory
700671
{{< /tab >}}
701672
{{< tab header="Ruby" >}}
702673
{{< badge-version version="4.8" >}}
703-
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L64" >}}
674+
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L113" >}}
704675
{{< /tab >}}
705676
{{< tab header="JavaScript" >}}
706677
{{< badge-code >}}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /