From 1d05141b508f8f4b6223373d7240242497d6b8d5 Mon Sep 17 00:00:00 2001 From: Navin Chandra Date: Mon, 25 Nov 2024 20:59:46 +0530 Subject: [PATCH] add docs for casting in java for chrome and edge --- .../java/dev/selenium/browsers/ChromeTest.java | 16 +++++++++++++++- .../java/dev/selenium/browsers/EdgeTest.java | 16 +++++++++++++++- .../webdriver/browsers/chrome.en.md | 2 +- .../webdriver/browsers/chrome.ja.md | 2 +- .../webdriver/browsers/chrome.pt-br.md | 2 +- .../webdriver/browsers/chrome.zh-cn.md | 2 +- .../documentation/webdriver/browsers/edge.en.md | 2 +- .../documentation/webdriver/browsers/edge.ja.md | 2 +- .../webdriver/browsers/edge.pt-br.md | 2 +- .../webdriver/browsers/edge.zh-cn.md | 2 +- 10 files changed, 38 insertions(+), 10 deletions(-) diff --git a/examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java b/examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java index 24e97185336..6470f25fa83 100644 --- a/examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java +++ b/examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java @@ -8,6 +8,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; +import java.util.Map; import java.util.logging.Level; import java.util.regex.Pattern; import org.junit.jupiter.api.AfterEach; @@ -31,7 +32,6 @@ public void clearProperties() { System.clearProperty(ChromeDriverService.CHROME_DRIVER_LOG_PROPERTY); System.clearProperty(ChromeDriverService.CHROME_DRIVER_LOG_LEVEL_PROPERTY); } - @Test public void basicOptions() { ChromeOptions options = new ChromeOptions(); @@ -222,4 +222,18 @@ public void setNetworkConditions() { ((ChromeDriver) driver).deleteNetworkConditions(); driver.quit(); } + + @Test + public void castFeatures() { + ChromeDriver driver = new ChromeDriver(); + + List> sinks = driver.getCastSinks(); + if (!sinks.isEmpty()) { + String sinkName = sinks.get(0).get("name"); + driver.startTabMirroring(sinkName); + driver.stopCasting(sinkName); + } + + driver.quit(); + } } diff --git a/examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java b/examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java index 11aa4f13f1e..4fefa2d08e2 100644 --- a/examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java +++ b/examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java @@ -8,6 +8,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; +import java.util.Map; import java.util.logging.Level; import java.util.regex.Pattern; import org.junit.jupiter.api.AfterEach; @@ -15,7 +16,6 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chromium.ChromiumDriverLogLevel; import org.openqa.selenium.chromium.ChromiumNetworkConditions; import org.openqa.selenium.edge.EdgeDriver; @@ -217,4 +217,18 @@ public void setNetworkConditions() { ((EdgeDriver) driver).deleteNetworkConditions(); driver.quit(); } + + @Test + public void castFeatures() { + EdgeDriver driver = new EdgeDriver(); + + List> sinks = driver.getCastSinks(); + if (!sinks.isEmpty()) { + String sinkName = sinks.get(0).get("name"); + driver.startTabMirroring(sinkName); + driver.stopCasting(sinkName); + } + + driver.quit(); + } } diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md index 6e4f28c6a71..205de921ae0 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md @@ -370,7 +370,7 @@ You can drive Chrome Cast devices, including sharing tabs {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java#L230-L235" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md index 241fbb3162b..e853f745b70 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md @@ -363,7 +363,7 @@ Chrome Castデバイスを操作することができ、タブの共有も含ま {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java#L230-L235" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md index e273d7f813a..368f7de908e 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md @@ -370,7 +370,7 @@ Pode comandar dispositivos Chrome Cast, incluindo partilhar abas {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java#L230-L235" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md b/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md index cf2dde60719..7232923f444 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md @@ -371,7 +371,7 @@ Chromedriver 和 Chrome 浏览器版本应该匹配, 如果它们不匹配, 驱 {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java#L230-L235" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}} 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 2bcae96e363..f0c3f3446bd 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.en.md @@ -372,7 +372,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L225-L230" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}} 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 cf8098c5581..c87c45b277f 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md @@ -358,7 +358,7 @@ Edge を使用して Chrome Cast デバイスを操作し、タブを共有す {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L225-L230" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}} 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 23e7599d04d..bfa70a3897f 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 @@ -374,7 +374,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L225-L230" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}} 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 cce5a9e4e36..5d66f8e6fcf 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 @@ -374,7 +374,7 @@ You can drive Chrome Cast devices with Edge, including sharing tabs {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java#L225-L230" >}} {{< /tab >}} {{< tab header="Python" >}} {{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}