@@ -37,7 +37,7 @@ def test_dialog_boxes(self):
3737 buttons = [(btn_text_1 , "green" ), (btn_text_2 , "purple" )]
3838 choice_2 = self .get_jqc_button_input (message , buttons )
3939 if choice_2 == btn_text_2 :
40- self .open ("https://xkcd.com/1287/" )
40+ self .open_if_not_url ("https://xkcd.com/1287/" )
4141 message = "Brain sports count as sports!<br /><br />"
4242 message += "Are you ready for more?"
4343 self .get_jqc_button_input (message , ["Let's Go!" ])
@@ -77,14 +77,12 @@ def test_dialog_boxes(self):
7777 self .set_jqc_theme ("bootstrap" , color = "red" , width = "32%" )
7878 if self .is_text_visible ("No matching documents" , ".md-search-result" ):
7979 self .get_jqc_button_input ("Your search had no results!" , ["OK" ])
80- elif self .is_element_visible ("a.md-search-result__link" ):
81- self .click ("a.md-search-result__link" )
82- self .set_jqc_theme ("bootstrap" , color = "green" , width = "32%" )
83- self .get_jqc_button_input ("You found search results!" , ["OK" ])
8480 elif self .is_text_visible ("Type to start searching" , "div.md-search" ):
8581 self .get_jqc_button_input ("You did not do a search!" , ["OK" ])
8682 else :
87- self .get_jqc_button_input ("We're not sure what happened." , ["OK" ])
83+ self .click_if_visible ("a.md-search-result__link" )
84+ self .set_jqc_theme ("bootstrap" , color = "green" , width = "32%" )
85+ self .get_jqc_button_input ("You found search results!" , ["OK" ])
8886
8987 self .open ("https://seleniumbase.io/help_docs/ReadMe/" )
9088 self .highlight ("h1" )
@@ -99,19 +97,20 @@ def test_dialog_boxes(self):
9997 message = "Now let's combine form inputs with multiple button options!"
10098 message += "<br /><br />"
10199 message += "Pick something to search. Then pick the site to search on."
102- buttons = ["XKCD.com" , "Wikipedia.org" ]
100+ buttons = ["XKCD.com Store " , "Wikipedia.org" ]
103101 text , choice = self .get_jqc_form_inputs (message , buttons )
104- if choice == "XKCD.com" :
105- self .open ("https://relevant- xkcd.github.io/ " )
102+ if choice == "XKCD.com Store " :
103+ self .open ("https://store. xkcd.com/search " )
106104 else :
107- self .open ("https://en.wikipedia.org/wiki/Main_Page " )
108- self .highlight_update_text ('input[name ="search"]' , text + "\n " )
105+ self .open ("https://en.wikipedia.org/wiki/Special:Search " )
106+ self .highlight_update_text ('input[id* ="search"]' , text + "\n " )
109107 self .wait_for_ready_state_complete ()
108+ self .sleep (1 )
110109 self .highlight ("body" )
111110 self .reset_jqc_theme ()
112111 self .get_jqc_button_input ("<b>Here are your results.</b>" , ["OK" ])
113112 message = "<h3>You've reached the end of this tutorial!</h3><br />"
114- message += "Thanks for learning about SeleniumBase Dialog Boxes!<br />"
115- message += "<br />Check out the SeleniumBase page on GitHub for more!"
113+ message += "Now you know about SeleniumBase Dialog Boxes!<br />"
114+ message += "<br />Check out SeleniumBase on GitHub for more!"
116115 self .set_jqc_theme ("modern" , color = "purple" , width = "56%" )
117116 self .get_jqc_button_input (message , ["Goodbye!" ])
0 commit comments