Skip to content

Commit 88c7b5c

Browse files
authored
[py]: add firefox context example for python (#2050)[deploy site]
add firefox python context example
1 parent 1114bfd commit 88c7b5c

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

examples/python/tests/browsers/test_firefox.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,13 @@ def test_full_page_screenshot(firefox_driver):
141141
assert os.path.exists("full_page_screenshot.png")
142142

143143
driver.quit()
144+
145+
146+
def test_set_context(firefox_driver):
147+
driver = firefox_driver
148+
149+
with driver.context(driver.CONTEXT_CHROME):
150+
driver.execute_script("console.log('Inside Chrome context');")
151+
152+
# Check if the context is back to content
153+
assert driver.execute("GET_CONTEXT")["value"] == "content"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,9 @@ please refer to the
443443
{{< tab header="Java" >}}
444444
{{< badge-code >}}
445445
{{< /tab >}}
446-
{{% tab header="Python" %}}
447-
{{< badge-code >}}
448-
{{% /tab %}}
446+
{{< tab header="Python" >}}
447+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
448+
{{< /tab >}}
449449
{{< tab header="CSharp" >}}
450450
{{< badge-code >}}
451451
{{< /tab >}}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ IDはアドオンインストール時の戻り値から取得できます。
439439
{{< tab header="Java" >}}
440440
{{< badge-code >}}
441441
{{< /tab >}}
442-
{{% tab header="Python" %}}
443-
{{< badge-code >}}
444-
{{% /tab %}}
442+
{{< tab header="Python" >}}
443+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
444+
{{< /tab >}}
445445
{{< tab header="CSharp" >}}
446446
{{< badge-code >}}
447447
{{< /tab >}}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ please refer to the
448448
{{< tab header="Java" >}}
449449
{{< badge-code >}}
450450
{{< /tab >}}
451-
{{% tab header="Python" %}}
452-
{{< badge-code >}}
453-
{{% /tab %}}
451+
{{< tab header="Python" >}}
452+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
453+
{{< /tab >}}
454454
{{< tab header="CSharp" >}}
455455
{{< badge-code >}}
456456
{{< /tab >}}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@ please refer to the
445445
{{< tab header="Java" >}}
446446
{{< badge-code >}}
447447
{{< /tab >}}
448-
{{% tab header="Python" %}}
449-
{{< badge-code >}}
450-
{{% /tab %}}
448+
{{< tab header="Python" >}}
449+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
450+
{{< /tab >}}
451451
{{< tab header="CSharp" >}}
452452
{{< badge-code >}}
453453
{{< /tab >}}

0 commit comments

Comments
 (0)