Skip to content

Commit 5bb14ff

Browse files
authored
Merge branch 'trunk' into petesong/add-practice-example
2 parents 4b279f8 + 777049f commit 5bb14ff

File tree

14 files changed

+136
-93
lines changed

14 files changed

+136
-93
lines changed

examples/python/tests/drivers/test_options.py

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,95 +5,101 @@
55

66
def test_page_load_strategy_normal():
77
options = webdriver.ChromeOptions()
8-
98
options.page_load_strategy = 'normal'
109
driver = webdriver.Chrome(options=options)
11-
1210
driver.get("https://www.selenium.dev/")
1311
driver.quit()
1412

1513

1614
def test_page_load_strategy_eager():
1715
options = webdriver.ChromeOptions()
18-
1916
options.page_load_strategy = 'eager'
2017
driver = webdriver.Chrome(options=options)
21-
2218
driver.get("https://www.selenium.dev/")
2319
driver.quit()
2420

2521

2622
def test_page_load_strategy_none():
2723
options = webdriver.ChromeOptions()
28-
2924
options.page_load_strategy = 'none'
3025
driver = webdriver.Chrome(options=options)
31-
32-
driver.get("https://www.selenium.dev/")
33-
driver.quit()
34-
35-
def test_capabilities():
36-
options = webdriver.ChromeOptions()
37-
options.browser_version = 'stable'
38-
options.platform_name = 'any'
39-
options.accept_insecure_certs = True
40-
driver = webdriver.Chrome(options=options)
41-
4226
driver.get("https://www.selenium.dev/")
4327
driver.quit()
4428

4529
def test_timeouts_script():
4630
options = webdriver.ChromeOptions()
4731
options.timeouts = { 'script': 5000 }
4832
driver = webdriver.Chrome(options=options)
49-
5033
driver.get("https://www.selenium.dev/")
5134
driver.quit()
5235

5336
def test_timeouts_page_load():
5437
options = webdriver.ChromeOptions()
5538
options.timeouts = { 'pageLoad': 5000 }
5639
driver = webdriver.Chrome(options=options)
57-
5840
driver.get("https://www.selenium.dev/")
5941
driver.quit()
6042

6143
def test_timeouts_implicit_wait():
6244
options = webdriver.ChromeOptions()
6345
options.timeouts = { 'implicit': 5000 }
6446
driver = webdriver.Chrome(options=options)
65-
6647
driver.get("https://www.selenium.dev/")
6748
driver.quit()
6849

6950
def test_unhandled_prompt():
7051
options = webdriver.ChromeOptions()
7152
options.unhandled_prompt_behavior = 'accept'
7253
driver = webdriver.Chrome(options=options)
73-
7454
driver.get("https://www.selenium.dev/")
7555
driver.quit()
7656

7757
def test_set_window_rect():
7858
options = webdriver.FirefoxOptions()
7959
options.set_window_rect = True # Full support in Firefox
8060
driver = webdriver.Firefox(options=options)
81-
8261
driver.get("https://www.selenium.dev/")
8362
driver.quit()
8463

8564
def test_strict_file_interactability():
8665
options = webdriver.ChromeOptions()
8766
options.strict_file_interactability = True
8867
driver = webdriver.Chrome(options=options)
89-
9068
driver.get("https://www.selenium.dev/")
9169
driver.quit()
9270

9371
def test_proxy():
9472
options = webdriver.ChromeOptions()
9573
options.proxy = Proxy({ 'proxyType': ProxyType.MANUAL, 'httpProxy' : 'http.proxy:1234'})
9674
driver = webdriver.Chrome(options=options)
97-
9875
driver.get("https://www.selenium.dev/")
99-
driver.quit()
76+
driver.quit()
77+
78+
def test_set_browser_name():
79+
options = webdriver.ChromeOptions()
80+
assert options.capabilities['browserName'] == 'chrome'
81+
driver = webdriver.Chrome(options=options)
82+
driver.get("https://www.selenium.dev/")
83+
driver.quit()
84+
85+
def test_set_browser_version():
86+
options = webdriver.ChromeOptions()
87+
options.browser_version = 'latest'
88+
assert options.capabilities['browserVersion'] == 'latest'
89+
driver = webdriver.Chrome(options=options)
90+
driver.get("https://www.selenium.dev/")
91+
driver.quit()
92+
93+
def test_platform_name():
94+
options = webdriver.ChromeOptions()
95+
options.platform_name = 'any'
96+
driver = webdriver.Chrome(options=options)
97+
driver.get("https://www.selenium.dev/")
98+
driver.quit()
99+
100+
def test_accept_insecure_certs():
101+
options = webdriver.ChromeOptions()
102+
options.accept_insecure_certs = True
103+
driver = webdriver.Chrome(options=options)
104+
driver.get("https://www.selenium.dev/")
105+
driver.quit()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pytest
2+
from selenium import webdriver
3+
from selenium.webdriver.common.print_page_options import PrintOptions
4+
5+
pytest.fixture()
6+
def driver():
7+
driver = webdriver.Chrome()
8+
yield driver
9+
driver.quit()
10+
11+
def test_prints_page(driver):
12+
driver.get("https://www.selenium.dev/")
13+
print_options = PrintOptions()
14+
pdf = driver.print_page(print_options)
15+
assert len(pdf) > 0

website_and_docs/content/blog/2024/selenium-milestone-20yrs-blog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,14 @@ Join Us in Celebrating Selenium’s Incredible Journey!
4242
For 20 years, Selenium has helped shape how we test, automate, and innovate on the web. This is your opportunity to celebrate that legacy and learn what the future holds for browser automation. We can’t wait to see you there!
4343
Event Organizers - **<a href="https://www.linkedin.com/in/maaret/" target="_blank">Maaret</a>**, **<a href="https://www.linkedin.com/in/diemol/" target="_blank">Diego</a>**, and **<a href="https://www.linkedin.com/in/pallavimuse/" target="_blank">Pallavi</a>**.
4444

45+
## Watch the Recording of Our 20th Anniversary Event
46+
47+
Couldn’t join us live? Watch the entire **"Celebrating 20 Years of Selenium"**
48+
event on YouTube. Relive the milestone moments, hear directly from
49+
the Selenium leadership team, and get insights into the future of browser automation.
50+
51+
📹 Recording Link: [Watch the Event Recording on YouTube](https://www.youtube.com/watch?v=TO-ZCl2LZ50)
52+
53+
This recording covers the highlights, including discussions on Selenium’s evolution,
54+
its role in the testing ecosystem, and the exciting advancements in WebDriver BiDi.
55+

website_and_docs/content/documentation/webdriver/drivers/options.en.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Browser name is set by default when using an Options class instance.
3434
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L73-74" >}}
3535
{{< /tab >}}
3636
{{% tab header="Python" %}}
37-
{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L36" >}}
37+
{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L79-80" >}}
3838
{{% /tab %}}
3939
{{< tab header="CSharp" >}}
4040
{{< badge-code >}}
@@ -61,7 +61,7 @@ it will be automatically downloaded by [Selenium Manager]({{< ref "../../seleniu
6161
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L80-82" >}}
6262
{{< /tab >}}
6363
{{% tab header="Python" %}}
64-
{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L37" >}}
64+
{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L86-88" >}}
6565
{{% /tab %}}
6666
{{< tab header="CSharp" >}}
6767
{{< badge-code >}}
@@ -117,7 +117,7 @@ event fire is returned.
117117
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L21-L23">}}
118118
{{< /tab >}}
119119
{{< tab header="Python" text=true >}}
120-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L9-L10">}}
120+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-9">}}
121121
{{< /tab >}}
122122
{{< tab header="CSharp" >}}
123123
using OpenQA.Selenium;
@@ -174,7 +174,7 @@ event fire is returned.
174174
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L34-L36">}}
175175
{{< /tab >}}
176176
{{< tab header="Python" text=true >}}
177-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L19-L20">}}
177+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L15-L17">}}
178178
{{< /tab >}}
179179
{{< tab header="CSharp" >}}
180180
using OpenQA.Selenium;
@@ -230,7 +230,7 @@ WebDriver only waits until the initial page is downloaded.
230230
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L47-L49">}}
231231
{{< /tab >}}
232232
{{< tab header="Python" text=true >}}
233-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L29-L30">}}
233+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L23-L25">}}
234234
{{< /tab >}}
235235
{{< tab header="CSharp" >}}
236236
using OpenQA.Selenium;
@@ -290,7 +290,7 @@ setting `platformName` sets the OS at the remote-end.
290290
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L88-L90">}}
291291
{{< /tab >}}
292292
{{% tab header="Python" %}}
293-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L38">}}
293+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L94-96">}}
294294
{{% /tab %}}
295295
{{< tab header="CSharp" >}}
296296
{{< badge-code >}}
@@ -328,7 +328,7 @@ effect for the entire session.
328328
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L60-L61">}}
329329
{{< /tab >}}
330330
{{% tab header="Python" %}}
331-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L39-40">}}
331+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L101-103">}}
332332
{{% /tab %}}
333333
{{< tab header="CSharp" >}}
334334
{{< badge-code >}}
@@ -363,7 +363,7 @@ is imposed when a new session is created by WebDriver.
363363
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L96-L98">}}
364364
{{< /tab >}}
365365
{{% tab header="Python" %}}
366-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L47-48">}}
366+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L30-32">}}
367367
{{% /tab %}}
368368
{{< tab header="CSharp" >}}
369369
{{< badge-code >}}
@@ -392,7 +392,7 @@ _TimeoutException_.
392392
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L111-L113">}}
393393
{{< /tab >}}
394394
{{% tab header="Python" %}}
395-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L55-56">}}
395+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L37-39">}}
396396
{{% /tab %}}
397397
{{< tab header="CSharp" >}}
398398
{{< badge-code >}}
@@ -419,7 +419,7 @@ is imposed when a new session is created by WebDriver.
419419
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L126-L128">}}
420420
{{< /tab >}}
421421
{{% tab header="Python" %}}
422-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L63-64">}}
422+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L44-46">}}
423423
{{% /tab %}}
424424
{{< tab header="CSharp" >}}
425425
{{< badge-code >}}
@@ -457,7 +457,7 @@ user prompt encounters at the remote-end. This is defined by
457457
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L141-L142">}}
458458
{{< /tab >}}
459459
{{% tab header="Python" %}}
460-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L71-72">}}
460+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L51-53">}}
461461
{{% /tab %}}
462462
{{< tab header="CSharp" >}}
463463
{{< badge-code >}}
@@ -482,7 +482,7 @@ Indicates whether the remote end supports all of the [resizing and repositioning
482482
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L151-L152">}}
483483
{{< /tab >}}
484484
{{% tab header="Python" %}}
485-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L79-80">}}
485+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L58-60">}}
486486
{{% /tab %}}
487487
{{< tab header="CSharp" >}}
488488
{{< badge-code >}}
@@ -510,7 +510,7 @@ when using _Element Send Keys_ with hidden file upload controls.
510510
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L163-L164">}}
511511
{{< /tab >}}
512512
{{% tab header="Python" %}}
513-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L87-88">}}
513+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L65-67">}}
514514
{{% /tab %}}
515515
{{< tab header="CSharp" >}}
516516
{{< badge-code >}}
@@ -571,7 +571,7 @@ public class ProxyTest {
571571
```
572572
{{% /tab %}}
573573
{{% tab header="Python" %}}
574-
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L95-96">}}
574+
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L72-74">}}
575575
{{% /tab %}}
576576
{{% tab header="CSharp" %}}
577577
```CSharp

0 commit comments

Comments
 (0)