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+ """
35
46import ast
57import 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"\n Attempts: %s' % (word .upper (), num_attempts ))
116118 else :
117119 print ('Final guess: "%s" (Not the correct word!)' % word .upper ())
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 " )
Original file line number Diff line number Diff line change 33
44class 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 = '\n Locale Code = "%s"' % locale_code
99 print (message )
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ('\n Word: "%s"\n Attempts: %s' % (word .upper (), num_attempts ))
9799 else :
98100 print ('Final guess: "%s" (Not the correct word!)' % word .upper ())
You can’t perform that action at this time.
0 commit comments