Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate and update ruby code examples with internet explorer #1748

Merged
merged 14 commits into from
Jun 19, 2024
Merged
58 changes: 57 additions & 1 deletion examples/ruby/spec/browsers/internet_explorer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper'

RSpec.describe 'Internet Explorer', exclusive: {platform: :windows} do
RSpec.describe 'Internet Explorer', exclusive: { platform: :windows } do
describe 'Options' do
let(:edge_location) { ENV.fetch('EDGE_BIN', nil) }

Expand All @@ -17,6 +17,40 @@
options = Selenium::WebDriver::Options.ie
@driver = Selenium::WebDriver.for :ie, options: options
end

it 'sets the file upload dialog timeout' do
options = Selenium::WebDriver::IE::Options.new
options.file_upload_dialog_timeout = 2000
driver = Selenium::WebDriver.for(:ie, options: options)
driver.quit
end

it 'ensures a clean session' do
options = Selenium::WebDriver::IE::Options.new
options.ensure_clean_session = true
driver = Selenium::WebDriver.for(:ie, options: options)
driver.quit
end

it 'ignores the zoom setting' do
options = Selenium::WebDriver::IE::Options.new
options.ignore_zoom_level = true
driver = Selenium::WebDriver.for(:ie, options: options)
driver.quit
end

it 'ignores the protected mode settings' do
options = Selenium::WebDriver::IE::Options.new
options.ignore_protected_mode_settings = true
driver = Selenium::WebDriver.for(:ie, options: options)
driver.quit
end

it 'adds the silent option' do
options = Selenium::WebDriver::IE::Options.new
options.add_option('silent', { silent: true })
expect(options.instance_variable_get(:@options)['silent']).to eq({ silent: true })
end
end

describe 'Service' do
Expand Down Expand Up @@ -66,4 +100,26 @@
@driver = Selenium::WebDriver.for :ie, service: service
end
end

it 'sets the command line options' do
options = Selenium::WebDriver::IE::Options.new
options.add_argument('-k')
driver = Selenium::WebDriver.for(:ie, options: options)
driver.get 'https://google.com'
puts(driver.capabilities.to_json)
driver.quit
end

it 'launches ie with the create process api' do
options = Selenium::WebDriver::IE::Options.new
options.force_create_process_api = true
driver = Selenium::WebDriver.for(:ie, options: options)

begin
driver.get 'https://google.com'
puts(driver.capabilities.to_json)
ensure
driver.quit
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ var options = new InternetExplorerOptions();
options.FileUploadDialogTimeout = TimeSpan.FromMilliseconds(2000);
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.file_upload_dialog_timeout = 2000
driver = Selenium::WebDriver.for(:ie, options: options)
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L22-L24" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
Expand Down Expand Up @@ -168,10 +166,8 @@ var options = new InternetExplorerOptions();
options.EnsureCleanSession = true;
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.ensure_clean_session = true
driver = Selenium::WebDriver.for(:ie, options: options)
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L29-L31" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
Expand Down Expand Up @@ -218,11 +214,9 @@ var options = new InternetExplorerOptions();
options.IgnoreZoomLevel = true;
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.ignore_zoom_level = true
driver = Selenium::WebDriver.for(:ie, options: options)
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L36-L38" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options().ignoreZoomSetting(true);
Expand Down Expand Up @@ -278,11 +272,9 @@ var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.ignore_protected_mode_settings = true
driver = Selenium::WebDriver.for(:ie, options: options)
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L43-L45" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options().introduceFlakinessByIgnoringProtectedModeSettings(true);
Expand Down Expand Up @@ -327,9 +319,9 @@ InternetExplorerOptions options = new InternetExplorerOptions();
options.AddAdditionalInternetExplorerOption("silent", true);
IWebDriver driver = new InternetExplorerDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L50-L51" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const {Builder,By, Capabilities} = require('selenium-webdriver');
let caps = Capabilities.ie();
Expand Down Expand Up @@ -437,20 +429,9 @@ namespace ieTest {
}
}
{{< /tab >}}
{{< tab header="Ruby" >}}
require 'selenium-webdriver'
options = Selenium::WebDriver::IE::Options.new
options.force_create_process_api = true
options.add_argument('-k')
driver = Selenium::WebDriver.for(:ie, options: options)

begin
driver.get 'https://google.com'
puts(driver.capabilities.to_json)
ensure
driver.quit
end
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L105-L107" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options();
Expand Down Expand Up @@ -541,19 +522,9 @@ namespace ieTest {
}
}
{{< /tab >}}
{{< tab header="Ruby" >}}
require 'selenium-webdriver'
options = Selenium::WebDriver::IE::Options.new
options.force_create_process_api = true
driver = Selenium::WebDriver.for(:ie, options: options)

begin
driver.get 'https://google.com'
puts(driver.capabilities.to_json)
ensure
driver.quit
end
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L114-L116" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options();
Expand Down Expand Up @@ -612,7 +583,7 @@ Property value: String representing path to log file
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.10" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L34" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L68" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -643,7 +614,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.10" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L43" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L77" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -672,7 +643,7 @@ Property value: String representation of `InternetExplorerDriverLogLevel.DEBUG.t
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.10" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L54" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L88" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -700,7 +671,7 @@ Property value: String representing path to supporting files directory
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L64" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L98" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ var options = new InternetExplorerOptions();
options.FileUploadDialogTimeout = TimeSpan.FromMilliseconds(2000);
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.file_upload_dialog_timeout = 2000
driver = Selenium::WebDriver.for(:ie, options: options)
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L22-L24" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
Expand Down Expand Up @@ -162,11 +160,9 @@ var options = new InternetExplorerOptions();
options.EnsureCleanSession = true;
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.ensure_clean_session = true
driver = Selenium::WebDriver.for(:ie, options: options)
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L29-L31" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options().ensureCleanSession(true);
Expand Down Expand Up @@ -211,11 +207,9 @@ var options = new InternetExplorerOptions();
options.IgnoreZoomLevel = true;
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.ignore_zoom_level = true
driver = Selenium::WebDriver.for(:ie, options: options)
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L36-L38" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options().ignoreZoomSetting(true);
Expand Down Expand Up @@ -267,11 +261,9 @@ var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
var driver = new RemoteWebDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
options = Selenium::WebDriver::IE::Options.new
options.ignore_protected_mode_settings = true
driver = Selenium::WebDriver.for(:ie, options: options)
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L43-L45" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options().introduceFlakinessByIgnoringProtectedModeSettings(true);
Expand Down Expand Up @@ -314,9 +306,9 @@ InternetExplorerOptions options = new InternetExplorerOptions();
options.AddAdditionalInternetExplorerOption("silent", true);
IWebDriver driver = new InternetExplorerDriver(options);
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-code >}}
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L50-L51" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const {Builder,By, Capabilities} = require('selenium-webdriver');
let caps = Capabilities.ie();
Expand Down Expand Up @@ -424,20 +416,9 @@ namespace ieTest {
}
}
{{< /tab >}}
{{< tab header="Ruby" >}}
require 'selenium-webdriver'
options = Selenium::WebDriver::IE::Options.new
options.force_create_process_api = true
options.add_argument('-k')
driver = Selenium::WebDriver.for(:ie, options: options)

begin
driver.get 'https://google.com'
puts(driver.capabilities.to_json)
ensure
driver.quit
end
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L105-L107" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options();
Expand Down Expand Up @@ -526,19 +507,9 @@ namespace ieTest {
}
}
{{< /tab >}}
{{< tab header="Ruby" >}}
require 'selenium-webdriver'
options = Selenium::WebDriver::IE::Options.new
options.force_create_process_api = true
driver = Selenium::WebDriver.for(:ie, options: options)

begin
driver.get 'https://google.com'
puts(driver.capabilities.to_json)
ensure
driver.quit
end
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L114-L116" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
const ie = require('selenium-webdriver/ie');
let options = new ie.Options();
Expand Down Expand Up @@ -600,7 +571,7 @@ Property value: String representing path to log file
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.10" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L34" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L68" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -631,7 +602,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.10" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L43" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L77" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -660,7 +631,7 @@ Property value: String representation of `InternetExplorerDriverLogLevel.DEBUG.t
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.10" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L54" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L88" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -688,7 +659,7 @@ Property value: String representing path to supporting files directory
{{< /tab >}}
{{< tab header="Ruby" >}}
{{< badge-version version="4.8" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L64" >}}
{{< gh-codeblock path="examples/ruby/spec/browsers/internet_explorer_spec.rb#L98" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down
Loading