From 88c7b5c74146841b8b5c56a06d65c2175cc0d5bf Mon Sep 17 00:00:00 2001 From: Navin Chandra <98466550+navin772@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:22:35 +0530 Subject: [PATCH] [py]: add firefox context example for python (#2050)[deploy site] add firefox python context example --- examples/python/tests/browsers/test_firefox.py | 10 ++++++++++ .../documentation/webdriver/browsers/firefox.en.md | 6 +++--- .../documentation/webdriver/browsers/firefox.ja.md | 6 +++--- .../documentation/webdriver/browsers/firefox.pt-br.md | 6 +++--- .../documentation/webdriver/browsers/firefox.zh-cn.md | 6 +++--- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/examples/python/tests/browsers/test_firefox.py b/examples/python/tests/browsers/test_firefox.py index 73c32961ab7..82ebc47abf3 100644 --- a/examples/python/tests/browsers/test_firefox.py +++ b/examples/python/tests/browsers/test_firefox.py @@ -141,3 +141,13 @@ def test_full_page_screenshot(firefox_driver): assert os.path.exists("full_page_screenshot.png") driver.quit() + + +def test_set_context(firefox_driver): + driver = firefox_driver + + with driver.context(driver.CONTEXT_CHROME): + driver.execute_script("console.log('Inside Chrome context');") + + # Check if the context is back to content + assert driver.execute("GET_CONTEXT")["value"] == "content" diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md index 8704f45b74b..bf5e46ce2a4 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md @@ -443,9 +443,9 @@ please refer to the {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md index 0658a929e09..dc97ef6e6d2 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md @@ -439,9 +439,9 @@ IDはアドオンインストール時の戻り値から取得できます。 {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md index 59a2a215213..52964b50e40 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md @@ -448,9 +448,9 @@ please refer to the {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md index 434da93da55..662d48020eb 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md @@ -445,9 +445,9 @@ please refer to the {{< tab header="Java" >}} {{< badge-code >}} {{< /tab >}} -{{% tab header="Python" %}} -{{< badge-code >}} -{{% /tab %}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}} +{{< /tab >}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}}