Skip to content

Commit 52da66f

Browse files
authored
Merge pull request #1592 from seleniumbase/python-3.11-official-support
Python 3.11 Official Support
2 parents 17a9082 + 08a8887 commit 52da66f

25 files changed

+619
-118
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ pytest my_first_test.py --pdb
564564
--window-size=WIDTH,HEIGHT # (Set the browser's starting window size.)
565565
--maximize # (Start tests with the browser window maximized.)
566566
--screenshot # (Save a screenshot at the end of each test.)
567+
--no-screenshot # (No screenshots saved unless tests directly ask it.)
567568
--visual-baseline # (Set the visual baseline for Visual/Layout tests.)
568569
--wire # (Use selenium-wire's webdriver for replacing selenium webdriver.)
569570
--external-pdf # (Set Chromium "plugins.always_open_pdf_externally":True.)

examples/wordle_archive_test.py renamed to examples/old_wordle_script.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
""" Solve the Wordle game using SeleniumBase.
2-
This test runs on archived versions of Wordle, containing Shadow-DOM. """
1+
"""
2+
Solve the Wordle game using SeleniumBase.
3+
This test runs on archived versions of Wordle, containing Shadow-DOM.
4+
"""
35

46
import ast
57
import random
@@ -86,7 +88,7 @@ def test_wordle(self):
8688
keyboard_base = "game-app::shadow game-keyboard::shadow "
8789
word = random.choice(self.word_list)
8890
num_attempts = 0
89-
success = False
91+
found_word = False
9092
for attempt in range(6):
9193
num_attempts += 1
9294
word = random.choice(self.word_list)
@@ -105,13 +107,13 @@ def test_wordle(self):
105107
letter_eval = self.get_attribute(tile % str(i), "evaluation")
106108
letter_status.append(letter_eval)
107109
if letter_status.count("correct") == 5:
108-
success = True
110+
found_word = True
109111
break
110112
self.word_list.remove(word)
111113
self.modify_word_list(word, letter_status)
112114

113115
self.save_screenshot_to_logs()
114-
if success:
116+
if found_word:
115117
print('Word: "%s"\nAttempts: %s' % (word.upper(), num_attempts))
116118
else:
117119
print('Final guess: "%s" (Not the correct word!)' % word.upper())

examples/raw_parameter_script.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
sb.maximize_option = False
8181
sb._disable_beforeunload = False
8282
sb.save_screenshot_after_test = False
83+
sb.no_screenshot_after_test = False
8384
sb.page_load_strategy = None
8485
sb.timeout_multiplier = None
8586
sb.pytest_html_report = None

examples/test_apple_site.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ def test_apple_developer_site_webdriver_instructions(self):
88
self.demo_mode = True
99
self.demo_sleep = 0.5
1010
self.message_duration = 2.0
11-
if self.headless and (
12-
self.browser == "chrome" or self.browser == "edge"
13-
):
14-
self.get_new_driver(browser=self.browser, headless2=True)
11+
if self.headless:
12+
if self._multithreaded:
13+
print("Skipping test in headless multi-threaded mode.")
14+
self.skip("Skipping test in headless multi-threaded mode.")
15+
elif self.undetectable:
16+
print("Skipping test in headless undetectable mode.")
17+
self.skip("Skipping test in headless undetectable mode.")
18+
elif self.browser == "chrome" or self.browser == "edge":
19+
self.get_new_driver(browser=self.browser, headless2=True)
1520
self.open("https://developer.apple.com/search/")
1621
title = "Testing with WebDriver in Safari"
1722
self.type('[placeholder*="developer.apple.com"]', title + "\n")

examples/test_get_locale_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class LocaleTests(BaseCase):
55
def test_get_locale_code(self):
6-
self.open("data:,")
6+
self.open("about:blank")
77
locale_code = self.get_locale_code()
88
message = '\nLocale Code = "%s"' % locale_code
99
print(message)

examples/visual_testing/test_layout_fail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_applitools_change(self):
2222
# Click a button that changes the text of an element
2323
self.click('a[href="?diff1"]')
2424
# Click a button that makes a hidden element visible
25-
self.click("button")
25+
self.slow_click("button")
2626
print("(This test should fail)") # due to image now seen
2727
self.check_window(name="helloworld", level=3)
2828

examples/wordle_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_wordle(self):
6464
self.initialize_word_list()
6565
word = random.choice(self.word_list)
6666
num_attempts = 0
67-
success = False
67+
found_word = False
6868
for attempt in range(6):
6969
num_attempts += 1
7070
word = random.choice(self.word_list)
@@ -74,25 +74,27 @@ def test_wordle(self):
7474
button = 'button[data-key="%s"]' % letter
7575
self.click(button)
7676
button = 'button[class*="oneAndAHalf"]'
77+
self.wait_for_ready_state_complete()
7778
self.click(button)
7879
row = (
7980
'div[class*="lbzlf"] div[class*="Row-module"]:nth-of-type(%s) '
8081
% num_attempts
8182
)
8283
tile = row + 'div:nth-child(%s) div[class*="module_tile__3ayIZ"]'
8384
self.wait_for_element(tile % "5" + '[data-state*="e"]')
85+
self.wait_for_ready_state_complete()
8486
letter_status = []
8587
for i in range(1, 6):
8688
letter_eval = self.get_attribute(tile % str(i), "data-state")
8789
letter_status.append(letter_eval)
8890
if letter_status.count("correct") == 5:
89-
success = True
91+
found_word = True
9092
break
9193
self.word_list.remove(word)
9294
self.modify_word_list(word, letter_status)
9395

9496
self.save_screenshot_to_logs()
95-
if success:
97+
if found_word:
9698
print('\nWord: "%s"\nAttempts: %s' % (word.upper(), num_attempts))
9799
else:
98100
print('Final guess: "%s" (Not the correct word!)' % word.upper())

help_docs/customizing_test_runs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ pytest my_first_test.py --settings-file=custom_settings.py
178178
--window-size=WIDTH,HEIGHT # (Set the browser's starting window size.)
179179
--maximize # (Start tests with the browser window maximized.)
180180
--screenshot # (Save a screenshot at the end of each test.)
181+
--no-screenshot # (No screenshots saved unless tests directly ask it.)
181182
--visual-baseline # (Set the visual baseline for Visual/Layout tests.)
182183
--wire # (Use selenium-wire's webdriver for replacing selenium webdriver.)
183184
--external-pdf # (Set Chromium "plugins.always_open_pdf_externally":True.)

mkdocs_build/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# mkdocs dependencies for generating the seleniumbase.io website
22
# Minimum Python version: 3.7
33

4-
regex>=2022.9.13
4+
regex>=2022.10.31
55
docutils==0.19
66
python-dateutil==2.8.2
77
livereload==2.6.3
@@ -14,7 +14,7 @@ Jinja2==3.1.2
1414
click==8.1.3
1515
zipp==3.10.0
1616
ghp-import==2.1.0
17-
readme-renderer==37.2
17+
readme-renderer==37.3
1818
pymdown-extensions==9.7
1919
importlib-metadata==5.0.0
2020
bleach==5.0.1
@@ -28,7 +28,7 @@ cairosvg==2.5.2
2828
cssselect2==0.7.0
2929
tinycss2==1.2.1
3030
defusedxml==0.7.1
31-
mkdocs==1.4.1
31+
mkdocs==1.4.2
3232
mkdocs-material==8.5.7
3333
mkdocs-exclude-search==0.6.4
3434
mkdocs-simple-hooks==0.1.5

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pytest-html==1.22.1;python_version<"3.6"
8080
pytest-html==2.0.1;python_version>="3.6"
8181
pytest-metadata==1.8.0;python_version<"3.6"
8282
pytest-metadata==1.11.0;python_version>="3.6" and python_version<"3.7"
83-
pytest-metadata==2.0.3;python_version>="3.7"
83+
pytest-metadata==2.0.4;python_version>="3.7"
8484
pytest-ordering==0.6
8585
pytest-rerunfailures==8.0;python_version<"3.6"
8686
pytest-rerunfailures==10.2;python_version>="3.6"
@@ -98,7 +98,7 @@ beautifulsoup4==4.9.3;python_version<"3.6"
9898
beautifulsoup4==4.11.1;python_version>="3.6"
9999
cryptography==2.9.2;python_version<"3.6"
100100
cryptography==36.0.2;python_version>="3.6" and python_version<"3.7"
101-
cryptography==38.0.1;python_version>="3.7"
101+
cryptography==38.0.3;python_version>="3.7"
102102
pygments==2.5.2;python_version<"3.6"
103103
pygments==2.13.0;python_version>="3.6"
104104
prompt-toolkit==1.0.18;python_version<"3.6"

0 commit comments

Comments
 (0)