Skip to content

Commit

Permalink
[py]: add example and docs for casting in edge and chrome (#2072)
Browse files Browse the repository at this point in the history
* add example for python casting for edge and chrome

* add docs for casting
  • Loading branch information
navin772 authored Nov 22, 2024
1 parent b0ff2d9 commit 6c18cac
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 27 deletions.
17 changes: 16 additions & 1 deletion examples/python/tests/browsers/test_chrome.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import re
import subprocess

import pytest
from selenium import webdriver


Expand Down Expand Up @@ -161,3 +161,18 @@ def get_permission_state(driver, name):
});
"""
return driver.execute_async_script(script, name)


def test_cast_features():
driver = webdriver.Chrome()

try:
sinks = driver.get_sinks()
if sinks:
sink_name = sinks[0]['name']
driver.start_tab_mirroring(sink_name)
driver.stop_casting(sink_name)
else:
pytest.skip("No available Cast sinks to test with.")
finally:
driver.quit()
17 changes: 16 additions & 1 deletion examples/python/tests/browsers/test_edge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import re
import subprocess

import pytest
from selenium import webdriver


Expand Down Expand Up @@ -161,3 +161,18 @@ def get_permission_state(driver, name):
});
"""
return driver.execute_async_script(script, name)


def test_cast_features():
driver = webdriver.Edge()

try:
sinks = driver.get_sinks()
if sinks:
sink_name = sinks[0]['name']
driver.start_tab_mirroring(sink_name)
driver.stop_casting(sink_name)
else:
pytest.skip("No available Cast sinks to test with.")
finally:
driver.quit()
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ You can drive Chrome Cast devices, including sharing tabs
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ Chrome Castデバイスを操作することができ、タブの共有も含ま
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ Pode comandar dispositivos Chrome Cast, incluindo partilhar abas
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,9 @@ Chromedriver 和 Chrome 浏览器版本应该匹配, 如果它们不匹配, 驱
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="CSharp" >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
{{< /tab >}}{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
{{< tab header="Ruby" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ Edge を使用して Chrome Cast デバイスを操作し、タブを共有す
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
{{< tab header="Java" >}}
{{< badge-code >}}
{{< /tab >}}
{{% tab header="Python" %}}
{{< badge-code >}}
{{% /tab %}}
{{< tab header="Python" >}}
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
{{< /tab >}}
{{< tab header="CSharp" >}}
{{< badge-code >}}
{{< /tab >}}
Expand Down

0 comments on commit 6c18cac

Please sign in to comment.