File tree Expand file tree Collapse file tree 6 files changed +24
-14
lines changed Expand file tree Collapse file tree 6 files changed +24
-14
lines changed Original file line number Diff line number Diff line change 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
+ """
3
5
4
6
import ast
5
7
import random
@@ -86,7 +88,7 @@ def test_wordle(self):
86
88
keyboard_base = "game-app::shadow game-keyboard::shadow "
87
89
word = random .choice (self .word_list )
88
90
num_attempts = 0
89
- success = False
91
+ found_word = False
90
92
for attempt in range (6 ):
91
93
num_attempts += 1
92
94
word = random .choice (self .word_list )
@@ -105,13 +107,13 @@ def test_wordle(self):
105
107
letter_eval = self .get_attribute (tile % str (i ), "evaluation" )
106
108
letter_status .append (letter_eval )
107
109
if letter_status .count ("correct" ) == 5 :
108
- success = True
110
+ found_word = True
109
111
break
110
112
self .word_list .remove (word )
111
113
self .modify_word_list (word , letter_status )
112
114
113
115
self .save_screenshot_to_logs ()
114
- if success :
116
+ if found_word :
115
117
print ('Word: "%s"\n Attempts: %s' % (word .upper (), num_attempts ))
116
118
else :
117
119
print ('Final guess: "%s" (Not the correct word!)' % word .upper ())
Original file line number Diff line number Diff line change 80
80
sb .maximize_option = False
81
81
sb ._disable_beforeunload = False
82
82
sb .save_screenshot_after_test = False
83
+ sb .no_screenshot_after_test = False
83
84
sb .page_load_strategy = None
84
85
sb .timeout_multiplier = None
85
86
sb .pytest_html_report = None
Original file line number Diff line number Diff line change @@ -8,10 +8,15 @@ def test_apple_developer_site_webdriver_instructions(self):
8
8
self .demo_mode = True
9
9
self .demo_sleep = 0.5
10
10
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 )
15
20
self .open ("https://developer.apple.com/search/" )
16
21
title = "Testing with WebDriver in Safari"
17
22
self .type ('[placeholder*="developer.apple.com"]' , title + "\n " )
Original file line number Diff line number Diff line change 3
3
4
4
class LocaleTests (BaseCase ):
5
5
def test_get_locale_code (self ):
6
- self .open ("data:, " )
6
+ self .open ("about:blank " )
7
7
locale_code = self .get_locale_code ()
8
8
message = '\n Locale Code = "%s"' % locale_code
9
9
print (message )
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def test_applitools_change(self):
22
22
# Click a button that changes the text of an element
23
23
self .click ('a[href="?diff1"]' )
24
24
# Click a button that makes a hidden element visible
25
- self .click ("button" )
25
+ self .slow_click ("button" )
26
26
print ("(This test should fail)" ) # due to image now seen
27
27
self .check_window (name = "helloworld" , level = 3 )
28
28
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def test_wordle(self):
64
64
self .initialize_word_list ()
65
65
word = random .choice (self .word_list )
66
66
num_attempts = 0
67
- success = False
67
+ found_word = False
68
68
for attempt in range (6 ):
69
69
num_attempts += 1
70
70
word = random .choice (self .word_list )
@@ -74,25 +74,27 @@ def test_wordle(self):
74
74
button = 'button[data-key="%s"]' % letter
75
75
self .click (button )
76
76
button = 'button[class*="oneAndAHalf"]'
77
+ self .wait_for_ready_state_complete ()
77
78
self .click (button )
78
79
row = (
79
80
'div[class*="lbzlf"] div[class*="Row-module"]:nth-of-type(%s) '
80
81
% num_attempts
81
82
)
82
83
tile = row + 'div:nth-child(%s) div[class*="module_tile__3ayIZ"]'
83
84
self .wait_for_element (tile % "5" + '[data-state*="e"]' )
85
+ self .wait_for_ready_state_complete ()
84
86
letter_status = []
85
87
for i in range (1 , 6 ):
86
88
letter_eval = self .get_attribute (tile % str (i ), "data-state" )
87
89
letter_status .append (letter_eval )
88
90
if letter_status .count ("correct" ) == 5 :
89
- success = True
91
+ found_word = True
90
92
break
91
93
self .word_list .remove (word )
92
94
self .modify_word_list (word , letter_status )
93
95
94
96
self .save_screenshot_to_logs ()
95
- if success :
97
+ if found_word :
96
98
print ('\n Word: "%s"\n Attempts: %s' % (word .upper (), num_attempts ))
97
99
else :
98
100
print ('Final guess: "%s" (Not the correct word!)' % word .upper ())
You can’t perform that action at this time.
0 commit comments