Skip to content

Commit 6c18cac

Browse files
authored
[py]: add example and docs for casting in edge and chrome (#2072)
* add example for python casting for edge and chrome * add docs for casting
1 parent b0ff2d9 commit 6c18cac

File tree

10 files changed

+56
-27
lines changed

10 files changed

+56
-27
lines changed

examples/python/tests/browsers/test_chrome.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import re
33
import subprocess
4-
4+
import pytest
55
from selenium import webdriver
66

77

@@ -161,3 +161,18 @@ def get_permission_state(driver, name):
161161
});
162162
"""
163163
return driver.execute_async_script(script, name)
164+
165+
166+
def test_cast_features():
167+
driver = webdriver.Chrome()
168+
169+
try:
170+
sinks = driver.get_sinks()
171+
if sinks:
172+
sink_name = sinks[0]['name']
173+
driver.start_tab_mirroring(sink_name)
174+
driver.stop_casting(sink_name)
175+
else:
176+
pytest.skip("No available Cast sinks to test with.")
177+
finally:
178+
driver.quit()

examples/python/tests/browsers/test_edge.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import re
33
import subprocess
4-
4+
import pytest
55
from selenium import webdriver
66

77

@@ -161,3 +161,18 @@ def get_permission_state(driver, name):
161161
});
162162
"""
163163
return driver.execute_async_script(script, name)
164+
165+
166+
def test_cast_features():
167+
driver = webdriver.Edge()
168+
169+
try:
170+
sinks = driver.get_sinks()
171+
if sinks:
172+
sink_name = sinks[0]['name']
173+
driver.start_tab_mirroring(sink_name)
174+
driver.stop_casting(sink_name)
175+
else:
176+
pytest.skip("No available Cast sinks to test with.")
177+
finally:
178+
driver.quit()

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ You can drive Chrome Cast devices, including sharing tabs
372372
{{< tab header="Java" >}}
373373
{{< badge-code >}}
374374
{{< /tab >}}
375-
{{% tab header="Python" %}}
376-
{{< badge-code >}}
377-
{{% /tab %}}
375+
{{< tab header="Python" >}}
376+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
377+
{{< /tab >}}
378378
{{< tab header="CSharp" >}}
379379
{{< badge-code >}}
380380
{{< /tab >}}

website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ Chrome Castデバイスを操作することができ、タブの共有も含ま
365365
{{< tab header="Java" >}}
366366
{{< badge-code >}}
367367
{{< /tab >}}
368-
{{% tab header="Python" %}}
369-
{{< badge-code >}}
370-
{{% /tab %}}
368+
{{< tab header="Python" >}}
369+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
370+
{{< /tab >}}
371371
{{< tab header="CSharp" >}}
372372
{{< badge-code >}}
373373
{{< /tab >}}

website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ Pode comandar dispositivos Chrome Cast, incluindo partilhar abas
372372
{{< tab header="Java" >}}
373373
{{< badge-code >}}
374374
{{< /tab >}}
375-
{{% tab header="Python" %}}
376-
{{< badge-code >}}
377-
{{% /tab %}}
375+
{{< tab header="Python" >}}
376+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
377+
{{< /tab >}}
378378
{{< tab header="CSharp" >}}
379379
{{< badge-code >}}
380380
{{< /tab >}}

website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,9 @@ Chromedriver 和 Chrome 浏览器版本应该匹配, 如果它们不匹配, 驱
373373
{{< tab header="Java" >}}
374374
{{< badge-code >}}
375375
{{< /tab >}}
376-
{{% tab header="Python" %}}
377-
{{< badge-code >}}
378-
{{% /tab %}}
379-
{{< tab header="CSharp" >}}
376+
{{< tab header="Python" >}}
377+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L170-L174" >}}
378+
{{< /tab >}}{{< tab header="CSharp" >}}
380379
{{< badge-code >}}
381380
{{< /tab >}}
382381
{{< tab header="Ruby" >}}

website_and_docs/content/documentation/webdriver/browsers/edge.en.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
374374
{{< tab header="Java" >}}
375375
{{< badge-code >}}
376376
{{< /tab >}}
377-
{{% tab header="Python" %}}
378-
{{< badge-code >}}
379-
{{% /tab %}}
377+
{{< tab header="Python" >}}
378+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
379+
{{< /tab >}}
380380
{{< tab header="CSharp" >}}
381381
{{< badge-code >}}
382382
{{< /tab >}}

website_and_docs/content/documentation/webdriver/browsers/edge.ja.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ Edge を使用して Chrome Cast デバイスを操作し、タブを共有す
360360
{{< tab header="Java" >}}
361361
{{< badge-code >}}
362362
{{< /tab >}}
363-
{{% tab header="Python" %}}
364-
{{< badge-code >}}
365-
{{% /tab %}}
363+
{{< tab header="Python" >}}
364+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
365+
{{< /tab >}}
366366
{{< tab header="CSharp" >}}
367367
{{< badge-code >}}
368368
{{< /tab >}}

website_and_docs/content/documentation/webdriver/browsers/edge.pt-br.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
376376
{{< tab header="Java" >}}
377377
{{< badge-code >}}
378378
{{< /tab >}}
379-
{{% tab header="Python" %}}
380-
{{< badge-code >}}
381-
{{% /tab %}}
379+
{{< tab header="Python" >}}
380+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
381+
{{< /tab >}}
382382
{{< tab header="CSharp" >}}
383383
{{< badge-code >}}
384384
{{< /tab >}}

website_and_docs/content/documentation/webdriver/browsers/edge.zh-cn.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ You can drive Chrome Cast devices with Edge, including sharing tabs
376376
{{< tab header="Java" >}}
377377
{{< badge-code >}}
378378
{{< /tab >}}
379-
{{% tab header="Python" %}}
380-
{{< badge-code >}}
381-
{{% /tab %}}
379+
{{< tab header="Python" >}}
380+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L170-L174" >}}
381+
{{< /tab >}}
382382
{{< tab header="CSharp" >}}
383383
{{< badge-code >}}
384384
{{< /tab >}}

0 commit comments

Comments
 (0)