Skip to content

Commit 69ddd84

Browse files
navin772harsha509
andauthored
[py]: add chrome and edge network conditions example and docs (#2054)
* add chrome and edge network conditions example * add chrome and edge network conditions docs --------- Co-authored-by: Sri Harsha <[email protected]>
1 parent 97a02a5 commit 69ddd84

File tree

10 files changed

+61
-24
lines changed

10 files changed

+61
-24
lines changed

examples/python/tests/browsers/test_chrome.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,22 @@ def test_build_checks(capfd):
121121
assert expected in err
122122

123123
driver.quit()
124+
125+
126+
def test_set_network_conditions():
127+
driver = webdriver.Chrome()
128+
129+
network_conditions = {
130+
"offline": False,
131+
"latency": 20, # 20 ms of latency
132+
"download_throughput": 2000 * 1024 / 8, # 2000 kbps
133+
"upload_throughput": 2000 * 1024 / 8, # 2000 kbps
134+
}
135+
driver.set_network_conditions(**network_conditions)
136+
137+
driver.get("https://www.selenium.dev")
138+
139+
# check whether the network conditions are set
140+
assert driver.get_network_conditions() == network_conditions
141+
142+
driver.quit()

examples/python/tests/browsers/test_edge.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,21 @@ def test_build_checks(log_path):
122122

123123
driver.quit()
124124

125+
126+
def test_set_network_conditions():
127+
driver = webdriver.Edge()
128+
129+
network_conditions = {
130+
"offline": False,
131+
"latency": 20, # 20 ms of latency
132+
"download_throughput": 2000 * 1024 / 8, # 2000 kbps
133+
"upload_throughput": 2000 * 1024 / 8, # 2000 kbps
134+
}
135+
driver.set_network_conditions(**network_conditions)
136+
137+
driver.get("https://www.selenium.dev")
138+
139+
# check whether the network conditions are set
140+
assert driver.get_network_conditions() == network_conditions
141+
142+
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
@@ -398,9 +398,9 @@ You can simulate various network conditions.
398398
{{< tab header="Java" >}}
399399
{{< badge-code >}}
400400
{{< /tab >}}
401-
{{% tab header="Python" %}}
402-
{{< badge-code >}}
403-
{{% /tab %}}
401+
{{< tab header="Python" >}}
402+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L129-L135" >}}
403+
{{< /tab >}}
404404
{{< tab header="CSharp" >}}
405405
{{< badge-code >}}
406406
{{< /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
@@ -392,9 +392,9 @@ Chrome Castデバイスを操作することができ、タブの共有も含ま
392392
{{< tab header="Java" >}}
393393
{{< badge-code >}}
394394
{{< /tab >}}
395-
{{% tab header="Python" %}}
396-
{{< badge-code >}}
397-
{{% /tab %}}
395+
{{< tab header="Python" >}}
396+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L129-L135" >}}
397+
{{< /tab >}}
398398
{{< tab header="CSharp" >}}
399399
{{< badge-code >}}
400400
{{< /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
@@ -401,9 +401,9 @@ please refer to the
401401
{{< tab header="Java" >}}
402402
{{< badge-code >}}
403403
{{< /tab >}}
404-
{{% tab header="Python" %}}
405-
{{< badge-code >}}
406-
{{% /tab %}}
404+
{{< tab header="Python" >}}
405+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L129-L135" >}}
406+
{{< /tab >}}
407407
{{< tab header="CSharp" >}}
408408
{{< badge-code >}}
409409
{{< /tab >}}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ Chromedriver 和 Chrome 浏览器版本应该匹配, 如果它们不匹配, 驱
402402
{{< tab header="Java" >}}
403403
{{< badge-code >}}
404404
{{< /tab >}}
405-
{{% tab header="Python" %}}
406-
{{< badge-code >}}
407-
{{% /tab %}}
405+
{{< tab header="Python" >}}
406+
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L129-L135" >}}
407+
{{< /tab >}}
408408
{{< tab header="CSharp" >}}
409409
{{< badge-code >}}
410410
{{< /tab >}}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ You can simulate various network conditions.
398398
{{< tab header="Java" >}}
399399
{{< badge-code >}}
400400
{{< /tab >}}
401-
{{% tab header="Python" %}}
402-
{{< badge-code >}}
403-
{{% /tab %}}
401+
{{< tab header="Python" >}}
402+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L129-L135" >}}
403+
{{< /tab >}}
404404
{{< tab header="CSharp" >}}
405405
{{< badge-code >}}
406406
{{< /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
@@ -384,9 +384,9 @@ Edge を使用して Chrome Cast デバイスを操作し、タブを共有す
384384
{{< tab header="Java" >}}
385385
{{< badge-code >}}
386386
{{< /tab >}}
387-
{{% tab header="Python" %}}
388-
{{< badge-code >}}
389-
{{% /tab %}}
387+
{{< tab header="Python" >}}
388+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L129-L135" >}}
389+
{{< /tab >}}
390390
{{< tab header="CSharp" >}}
391391
{{< badge-code >}}
392392
{{< /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
@@ -400,9 +400,9 @@ You can simulate various network conditions.
400400
{{< tab header="Java" >}}
401401
{{< badge-code >}}
402402
{{< /tab >}}
403-
{{% tab header="Python" %}}
404-
{{< badge-code >}}
405-
{{% /tab %}}
403+
{{< tab header="Python" >}}
404+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L129-L135" >}}
405+
{{< /tab >}}
406406
{{< tab header="CSharp" >}}
407407
{{< badge-code >}}
408408
{{< /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
@@ -400,9 +400,9 @@ You can simulate various network conditions.
400400
{{< tab header="Java" >}}
401401
{{< badge-code >}}
402402
{{< /tab >}}
403-
{{% tab header="Python" %}}
404-
{{< badge-code >}}
405-
{{% /tab %}}
403+
{{< tab header="Python" >}}
404+
{{< gh-codeblock path="/examples/python/tests/browsers/test_edge.py#L129-L135" >}}
405+
{{< /tab >}}
406406
{{< tab header="CSharp" >}}
407407
{{< badge-code >}}
408408
{{< /tab >}}

0 commit comments

Comments
 (0)