From 3afb74246b731e0a4c84c62a0f12f5db4a1e8220 Mon Sep 17 00:00:00 2001 From: Navin Chandra <98466550+navin772@users.noreply.github.com> Date: Wed, 27 Nov 2024 22:36:20 +0530 Subject: [PATCH] [java]: add docs for casting in java for chrome and edge (#2077) add docs for casting in java for chrome and edge Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com> --- .../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 73e15db6b80..0284e0463db 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 cbeac4e63b9..1717d82bde2 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 45a11b1d349..d4098435d9a 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 b08634037c0..773c74516f5 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 f31f9e17e66..5fc35d60924 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 e86c9aaeaa9..7b5f73f5614 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 5afe7d1e32c..a7fbd686ea7 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 50e7b05b855..8338c667406 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" >}}