From 6c18cac97caa6c98c465f827fd790463444fd789 Mon Sep 17 00:00:00 2001 From: Navin Chandra <98466550+navin772@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:51:52 +0530 Subject: [PATCH] [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 --- examples/python/tests/browsers/test_chrome.py | 17 ++++++++++++++++- examples/python/tests/browsers/test_edge.py | 17 ++++++++++++++++- .../webdriver/browsers/chrome.en.md | 6 +++--- .../webdriver/browsers/chrome.ja.md | 6 +++--- .../webdriver/browsers/chrome.pt-br.md | 6 +++--- .../webdriver/browsers/chrome.zh-cn.md | 7 +++---- .../documentation/webdriver/browsers/edge.en.md | 6 +++--- .../documentation/webdriver/browsers/edge.ja.md | 6 +++--- .../webdriver/browsers/edge.pt-br.md | 6 +++--- .../webdriver/browsers/edge.zh-cn.md | 6 +++--- 10 files changed, 56 insertions(+), 27 deletions(-) diff --git a/examples/python/tests/browsers/test_chrome.py b/examples/python/tests/browsers/test_chrome.py index e68daf32650..55667f51465 100644 --- a/examples/python/tests/browsers/test_chrome.py +++ b/examples/python/tests/browsers/test_chrome.py @@ -1,7 +1,7 @@ import os import re import subprocess - +import pytest from selenium import webdriver @@ -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() diff --git a/examples/python/tests/browsers/test_edge.py b/examples/python/tests/browsers/test_edge.py index d478f511166..363b15ea49f 100644 --- a/examples/python/tests/browsers/test_edge.py +++ b/examples/python/tests/browsers/test_edge.py @@ -1,7 +1,7 @@ import os import re import subprocess - +import pytest from selenium import webdriver @@ -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() 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 511793595a0..462899b356c 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.en.md @@ -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 >}} 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 d467f29bd71..73053fe3207 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md @@ -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 >}} 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 4ab23dc41ea..8a96b3ac18d 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 @@ -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 >}} 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 7c11540fc1b..e86557c85b4 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 @@ -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" >}} 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 9b8ae30a1ee..04768b23e45 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.en.md @@ -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 >}} 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 2d693ad8533..ff9237645e6 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/edge.ja.md @@ -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 >}} 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 92201fe03c0..ce8bbb9505b 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 @@ -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 >}} 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 417ffc7a529..a6d3aaa67de 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 @@ -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 >}}