Skip to content

Commit cb2ea86

Browse files
aguspeharsha509
andauthored
Add firefox special features using ruby and migrate examples (#1744)[deploy site]
* Add all special features examples for firefox using ruby * Migrate code to examples --------- Co-authored-by: aguspe <[email protected]> Co-authored-by: Sri Harsha <[email protected]>
1 parent 29ba6ab commit cb2ea86

File tree

5 files changed

+39
-28
lines changed

5 files changed

+39
-28
lines changed

examples/ruby/spec/browsers/firefox_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,29 @@
118118
injected = driver.find_element(id: 'webextensions-selenium-example')
119119
expect(injected.text).to eq 'Content injected by webextensions-selenium-example'
120120
end
121+
122+
it 'takes full page screenshot' do
123+
driver.navigate.to 'https://www.selenium.dev/selenium/web/blank.html'
124+
Dir.mktmpdir('screenshot_test') do |dir|
125+
screenshot = driver.save_full_page_screenshot(File.join(dir, 'screenshot.png'))
126+
127+
expect(screenshot).to be_a File
128+
end
129+
end
130+
131+
it 'sets the context' do
132+
driver.context = 'content'
133+
expect(driver.context).to eq 'content'
134+
end
135+
end
136+
137+
describe 'Profile' do
138+
it 'creates a new profile' do
139+
profile = Selenium::WebDriver::Firefox::Profile.new
140+
profile['browser.download.dir'] = '/tmp/webdriver-downloads'
141+
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
142+
expect(options.profile).to eq(profile)
143+
end
121144
end
122145

123146
def driver_finder

website_and_docs/content/documentation/webdriver/browsers/firefox.en.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,8 @@ var profile = new FirefoxProfile();
122122
options.Profile = profile;
123123
var driver = new FirefoxDriver(options);
124124
{{< /tab >}}
125-
{{< tab header="Ruby" >}}
126-
profile = Selenium::WebDriver::Firefox::Profile.new
127-
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
128-
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
129-
driver = Selenium::WebDriver.for :firefox, options: options
125+
{{< tab header="Ruby" text=true >}}
126+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L139-L141" >}}
130127
{{< /tab >}}
131128
{{< tab header="JavaScript" >}}
132129
const { Builder } = require("selenium-webdriver");
@@ -426,7 +423,7 @@ please refer to the
426423
{{< badge-code >}}
427424
{{< /tab >}}
428425
{{< tab header="Ruby" >}}
429-
{{< badge-code >}}
426+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L125" >}}
430427
{{< /tab >}}
431428
{{< tab header="JavaScript" >}}
432429
{{< badge-code >}}
@@ -453,7 +450,7 @@ please refer to the
453450
{{< badge-code >}}
454451
{{< /tab >}}
455452
{{< tab header="Ruby" >}}
456-
{{< badge-code >}}
453+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L132" >}}
457454
{{< /tab >}}
458455
{{< tab header="JavaScript" >}}
459456
{{< badge-code >}}

website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,8 @@ var profile = new FirefoxProfile();
126126
options.Profile = profile;
127127
var driver = new RemoteWebDriver(options);
128128
{{< /tab >}}
129-
{{< tab header="Ruby" >}}
130-
profile = Selenium::WebDriver::Firefox::Profile.new
131-
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
132-
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
133-
driver = Selenium::WebDriver.for :firefox, options: options
129+
{{< tab header="Ruby" text=true >}}
130+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L139-L141" >}}
134131
{{< /tab >}}
135132
{{< tab header="JavaScript" >}}
136133
const { Builder } = require("selenium-webdriver");
@@ -433,7 +430,7 @@ please refer to the
433430
{{< badge-code >}}
434431
{{< /tab >}}
435432
{{< tab header="Ruby" >}}
436-
{{< badge-code >}}
433+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L125" >}}
437434
{{< /tab >}}
438435
{{< tab header="JavaScript" >}}
439436
{{< badge-code >}}
@@ -460,7 +457,7 @@ please refer to the
460457
{{< badge-code >}}
461458
{{< /tab >}}
462459
{{< tab header="Ruby" >}}
463-
{{< badge-code >}}
460+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L132" >}}
464461
{{< /tab >}}
465462
{{< tab header="JavaScript" >}}
466463
{{< badge-code >}}

website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,8 @@ var profile = new FirefoxProfile();
125125
options.Profile = profile;
126126
var driver = new RemoteWebDriver(options);
127127
{{< /tab >}}
128-
{{< tab header="Ruby" >}}
129-
profile = Selenium::WebDriver::Firefox::Profile.new
130-
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
131-
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
132-
driver = Selenium::WebDriver.for :firefox, options: options
128+
{{< tab header="Ruby" text=true >}}
129+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L139-L141" >}}
133130
{{< /tab >}}
134131
{{< tab header="JavaScript" >}}
135132
const { Builder } = require("selenium-webdriver");
@@ -431,7 +428,7 @@ please refer to the
431428
{{< badge-code >}}
432429
{{< /tab >}}
433430
{{< tab header="Ruby" >}}
434-
{{< badge-code >}}
431+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L125" >}}
435432
{{< /tab >}}
436433
{{< tab header="JavaScript" >}}
437434
{{< badge-code >}}
@@ -458,7 +455,7 @@ please refer to the
458455
{{< badge-code >}}
459456
{{< /tab >}}
460457
{{< tab header="Ruby" >}}
461-
{{< badge-code >}}
458+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L132" >}}
462459
{{< /tab >}}
463460
{{< tab header="JavaScript" >}}
464461
{{< badge-code >}}

website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,8 @@ var profile = new FirefoxProfile();
124124
options.Profile = profile;
125125
var driver = new RemoteWebDriver(options);
126126
{{< /tab >}}
127-
{{< tab header="Ruby" >}}
128-
profile = Selenium::WebDriver::Firefox::Profile.new
129-
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
130-
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
131-
driver = Selenium::WebDriver.for :firefox, options: options
127+
{{< tab header="Ruby" text=true >}}
128+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L139-L141" >}}
132129
{{< /tab >}}
133130
{{< tab header="JavaScript" >}}
134131
const { Builder } = require("selenium-webdriver");
@@ -428,7 +425,7 @@ please refer to the
428425
{{< badge-code >}}
429426
{{< /tab >}}
430427
{{< tab header="Ruby" >}}
431-
{{< badge-code >}}
428+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L125" >}}
432429
{{< /tab >}}
433430
{{< tab header="JavaScript" >}}
434431
{{< badge-code >}}
@@ -455,7 +452,7 @@ please refer to the
455452
{{< badge-code >}}
456453
{{< /tab >}}
457454
{{< tab header="Ruby" >}}
458-
{{< badge-code >}}
455+
{{< gh-codeblock path="/examples/ruby/spec/browsers/firefox_spec.rb#L132" >}}
459456
{{< /tab >}}
460457
{{< tab header="JavaScript" >}}
461458
{{< badge-code >}}

0 commit comments

Comments
 (0)