diff --git a/examples/ruby/spec/browsers/edge_spec.rb b/examples/ruby/spec/browsers/edge_spec.rb index 93eae18ddd7..225f8c601c4 100644 --- a/examples/ruby/spec/browsers/edge_spec.rb +++ b/examples/ruby/spec/browsers/edge_spec.rb @@ -113,6 +113,47 @@ end end + describe 'Special Features' do + it 'casts' do + @driver = Selenium::WebDriver.for :edge + sinks = @driver.cast_sinks + unless sinks.empty? + device_name = sinks.first['name'] + @driver.start_cast_tab_mirroring(device_name) + expect { @driver.stop_casting(device_name) }.not_to raise_exception + end + end + + it 'gets and sets network conditions' do + @driver = Selenium::WebDriver.for :edge + @driver.network_conditions = {offline: false, latency: 100, throughput: 200} + expect(@driver.network_conditions).to eq( + 'offline' => false, + 'latency' => 100, + 'download_throughput' => 200, + 'upload_throughput' => 200) + end + + it 'gets the browser logs' do + @driver = Selenium::WebDriver.for :edge + @driver.navigate.to 'https://www.selenium.dev/selenium/web/' + sleep 1 + logs = @driver.logs.get(:browser) + + expect(logs.first.message).to include 'Failed to load resource' + end + + it 'sets permissions' do + @driver = Selenium::WebDriver.for :edge + @driver.navigate.to 'https://www.selenium.dev/selenium/web/' + @driver.add_permission('camera', 'denied') + @driver.add_permissions('clipboard-read' => 'denied', 'clipboard-write' => 'prompt') + expect(permission('camera')).to eq('denied') + expect(permission('clipboard-read')).to eq('denied') + expect(permission('clipboard-write')).to eq('prompt') + end + end + def driver_finder options = Selenium::WebDriver::Options.edge(browser_version: 'stable') service = Selenium::WebDriver::Service.edge @@ -120,4 +161,9 @@ def driver_finder ENV['EDGEDRIVER_BIN'] = finder.driver_path ENV['EDGE_BIN'] = finder.browser_path end + + def permission(name) + @driver.execute_async_script('callback = arguments[arguments.length - 1];' \ + 'callback(navigator.permissions.query({name: arguments[0]}));', name)['state'] + end end diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.en.md b/website_and_docs/content/documentation/webdriver/browsers/edge.en.md index f3b8e999fce..3ee56293f88 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.en.md @@ -380,7 +380,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -405,7 +405,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -428,7 +428,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -451,7 +451,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md b/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md index 907bd27a969..207c0710c0a 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md @@ -382,7 +382,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -407,7 +407,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -430,7 +430,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -453,7 +453,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md b/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md index 42fff09a955..a7f2b1c0a64 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md @@ -382,7 +382,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -407,7 +407,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -430,7 +430,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -453,7 +453,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md b/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md index b6e2bafded9..618ca4257f9 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md @@ -382,7 +382,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L119-L123" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -407,7 +407,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L129" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -430,7 +430,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L141" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} @@ -453,7 +453,7 @@ You can simulate various network conditions. {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/ruby/spec/browsers/edge_spec.rb#L149-L150" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}}