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
50 changes: 49 additions & 1 deletion examples/ruby/spec/browsers/internet_explorer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
RSpec.describe 'Internet Explorer', exclusive: {platform: :windows} do
describe 'Options' do
let(:edge_location) { ENV.fetch('EDGE_BIN', nil) }
let(:url) { 'https://www.selenium.dev/selenium/web/' }

before do
@options = Selenium::WebDriver::IE::Options.new
@options.attach_to_edge_chrome = true
@options.edge_executable_path = edge_location
end

it 'basic options Win10' do
options = Selenium::WebDriver::Options.ie
options = Selenium::WebDriver::IE::Options.new
options.attach_to_edge_chrome = true
options.edge_executable_path = edge_location
@driver = Selenium::WebDriver.for :ie, options: options
Expand All @@ -17,6 +24,47 @@
options = Selenium::WebDriver::Options.ie
@driver = Selenium::WebDriver.for :ie, options: options
end

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

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

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

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

it 'adds the silent option', skip: 'This capability will be added on the release 4.22.0' do
@options.silent = true
expect(@options.silent).to be_truthy
end

it 'sets the command line options' do
@options.add_argument('-k')
Selenium::WebDriver.for(:ie, options: @options)
end

it 'launches ie with the create process api', skip: 'When using with IE 8 or higher, it needs a registry value' do
@options.force_create_process_api = true
Selenium::WebDriver.for(:ie, options: @options)
expect(@options.instance_variable_get(:@options)['force_create_process_api'])
.to eq({force_create_process_api: true})
end
end

describe 'Service' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Starting a Microsoft Edge browser in Internet Explorer Compatibility mode with b
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L35-L38" >}}
{{% /tab %}}
{{< tab header="Ruby" >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L10-L13" >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L17-L20" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down Expand Up @@ -68,7 +68,7 @@ So, if IE is not on the system, you only need:
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L44-L45" >}}
{{% /tab %}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L17-L18" >}}
{{< gh-codeblock path="/examples/ruby/spec/browsers/internet_explorer_spec.rb#L24-L25" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
let driver = await new Builder()
Expand Down 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#L29-L30" >}}
{{< /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#L35-L36" >}}
{{< /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#L41-L42" >}}
{{< /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#L47-L48" >}}
{{< /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#L53-L54" >}}
{{< /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#L59-L60" >}}
{{< /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#L64-L65" >}}
{{< /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#L83" >}}
{{< /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#L101" >}}
{{< /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#L103" >}}
{{< /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#L113" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
{{< badge-code >}}
Expand Down
Loading
Loading