Skip to content

Commit

Permalink
[java]: add docs for casting in java for chrome and edge (#2077)
Browse files Browse the repository at this point in the history
add docs for casting in java for chrome and edge

Co-authored-by: Sri Harsha <[email protected]>
  • Loading branch information
navin772 and harsha509 authored Nov 27, 2024
1 parent 588ba47 commit 3afb742
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -222,4 +222,18 @@ public void setNetworkConditions() {
((ChromeDriver) driver).deleteNetworkConditions();
driver.quit();
}

@Test
public void castFeatures() {
ChromeDriver driver = new ChromeDriver();

List<Map<String, String>> sinks = driver.getCastSinks();
if (!sinks.isEmpty()) {
String sinkName = sinks.get(0).get("name");
driver.startTabMirroring(sinkName);
driver.stopCasting(sinkName);
}

driver.quit();
}
}
16 changes: 15 additions & 1 deletion examples/java/src/test/java/dev/selenium/browsers/EdgeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
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;
import org.junit.jupiter.api.Assertions;
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;
Expand Down Expand Up @@ -217,4 +217,18 @@ public void setNetworkConditions() {
((EdgeDriver) driver).deleteNetworkConditions();
driver.quit();
}

@Test
public void castFeatures() {
EdgeDriver driver = new EdgeDriver();

List<Map<String, String>> sinks = driver.getCastSinks();
if (!sinks.isEmpty()) {
String sinkName = sinks.get(0).get("name");
driver.startTabMirroring(sinkName);
driver.stopCasting(sinkName);
}

driver.quit();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}
Expand Down

0 comments on commit 3afb742

Please sign in to comment.