Skip to content

Commit 7e24499

Browse files
committed
Update example tests
1 parent 1dd9c70 commit 7e24499

File tree

9 files changed

+43
-57
lines changed

9 files changed

+43
-57
lines changed

examples/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="320" />
1+
[<img src="https://seleniumbase.io/cdn/img/sb_logo_10t.png" title="SeleniumBase" width="220">](https://github.com/seleniumbase/SeleniumBase/)
22

33
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Running Example Tests:</h2>
44

@@ -169,7 +169,7 @@ python gui_test_runner.py
169169

170170
--------
171171

172-
<img src="https://seleniumbase.io/cdn/img/super_logo_sb4.png" title="SeleniumBase" width="320" />
172+
<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="320" />
173173

174174
<a href="https://github.com/seleniumbase/SeleniumBase">
175175
<img src="https://img.shields.io/badge/tested%20with-SeleniumBase-04C38E.svg" alt="Tested with SeleniumBase" /></a>

examples/dialog_boxes/dialog_box_tour.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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!"])

examples/parameterized_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class GoogleTests(BaseCase):
77
[
88
["PyPI", "pypi.org", 'img[alt="PyPI"]'],
99
["Wikipedia", "www.wikipedia.org", "img.central-featured-logo"],
10-
["SeleniumBase GitHub", "SeleniumBase - GitH", 'img[title*="Se"]'],
10+
["SeleniumBase GitHub", "Selenium, Python", 'img[title*="Selen"]'],
1111
]
1212
)
1313
def test_parameterized_google_search(self, search_key, expected_text, img):

examples/presenter/ReadMe.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="360" /></h3>
1+
[<img src="https://seleniumbase.io/cdn/img/sb_logo_10t.png" title="SeleniumBase" width="220">](https://github.com/seleniumbase/SeleniumBase/)
22

3-
<h1> 📰 Presenter 📑 </h1>
3+
<h1> 📑 Presenter / Slides 🎞️ </h1>
44

5-
<p>SeleniumBase Presenter lets you use Python to generate HTML presentations from Reveal JS.</p>
5+
<p>SeleniumBase Presenter / Slides lets you use Python to generate HTML presentations and slide shows from Reveal-JS.</p>
66

77
<b>Here's a sample presentation:</b>
88

@@ -244,3 +244,7 @@ Presentations automatically get saved when calling:
244244
```python
245245
self.begin_presentation(show_notes=True)
246246
```
247+
248+
--------
249+
250+
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="240" /></h3>

examples/test_checkboxes.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,13 @@
33

44
class CheckboxTests(BaseCase):
55
def test_checkboxes_and_radio_buttons(self):
6-
self.open(
7-
"https://www.w3schools.com/tags/tryit.asp"
8-
"?filename=tryhtml5_input_type_checkbox"
9-
)
10-
self.ad_block()
6+
self.open("https://seleniumbase.io/w3schools/checkboxes")
117
self.switch_to_frame("iframeResult")
128
checkbox = "input#vehicle2"
139
self.assert_false(self.is_selected(checkbox))
1410
self.click(checkbox)
1511
self.assert_true(self.is_selected(checkbox))
16-
self.open(
17-
"https://www.w3schools.com/tags/tryit.asp"
18-
"?filename=tryhtml5_input_type_radio"
19-
)
12+
self.open("https://seleniumbase.io/w3schools/radio_buttons")
2013
self.switch_to_frame("iframeResult")
2114
option_button = "input#css"
2215
self.assert_false(self.is_selected(option_button))

examples/test_double_click.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,13 @@
33

44
class DoubleClickTests(BaseCase):
55
def test_switch_to_frame_and_double_click(self):
6-
self.open(
7-
"https://www.w3schools.com/jsref"
8-
"/tryit.asp?filename=tryjsref_ondblclick"
9-
)
10-
self.ad_block()
6+
self.open("https://seleniumbase.io/w3schools/double_click")
117
self.switch_to_frame("iframe#iframeResult")
128
self.double_click('[ondblclick="myFunction()"]')
139
self.assert_text("Hello World", "#demo")
1410

1511
def test_switch_to_frame_of_element_and_double_click(self):
16-
self.open(
17-
"https://www.w3schools.com/jsref"
18-
"/tryit.asp?filename=tryjsref_ondblclick"
19-
)
20-
self.ad_block()
12+
self.open("https://seleniumbase.io/w3schools/double_click")
2113
self.switch_to_frame_of_element('[ondblclick="myFunction()"]')
2214
self.double_click('[ondblclick="myFunction()"]')
2315
self.assert_text("Hello World", "#demo")

examples/test_drag_and_drop.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def test_drag_and_drop(self):
1313
self.sleep(0.8)
1414

1515
def test_w3schools_drag_and_drop(self):
16-
url = "://w3schools.com/html/tryit.asp?filename=tryhtml5_draganddrop"
17-
self.open(url)
16+
self.open("https://seleniumbase.io/w3schools/drag_drop")
1817
self.remove_elements("#tryitLeaderboard")
1918
self.switch_to_frame("iframeResult")
2019
self.assert_element_not_visible("#div1 img#drag1")

examples/test_iframes.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@
33

44
class FrameTests(BaseCase):
55
def test_iframe_basics(self):
6-
self.open(
7-
"https://www.w3schools.com/html/tryit.asp"
8-
"?filename=tryhtml_iframe_height_width_css"
9-
)
10-
self.ad_block() # Reduce noise during automation
11-
self.switch_to_frame("iframeResult") # Enter the iFrame
6+
self.open("https://seleniumbase.io/w3schools/iframes.html")
7+
self.switch_to_frame("iframeResult") # Enter the iframe
128
self.assert_text("HTML Iframes", "h2")
13-
self.switch_to_frame('[title*="Iframe"]') # Enter iFrame inside iFrame
9+
self.switch_to_frame('[title*="Iframe"]') # Enter iframe inside iframe
1410
self.assert_text("This page is displayed in an iframe", "h1")
1511
self.switch_to_default_content() # Exit all iFrames
16-
self.switch_to_frame("iframeResult") # Go back inside 1st iFrame
12+
self.click("button#runbtn")
13+
self.switch_to_frame("iframeResult") # Go back inside 1st iframe
1714
self.highlight('iframe[title="Iframe Example"]')
1815

1916
def test_set_content_to_frame(self):
20-
self.open(
21-
"https://www.w3schools.com/html/tryit.asp"
22-
"?filename=tryhtml_iframe_height_width_css"
23-
)
17+
self.open("https://seleniumbase.io/w3schools/iframes.html")
2418
self.set_content_to_frame("iframeResult")
25-
self.highlight('iframe[title="Iframe Example"]', loops=8)
19+
self.highlight('iframe[title="Iframe Example"]')
20+
self.set_content_to_frame("iframe")
21+
self.assert_element_not_visible('iframe')
22+
self.highlight("body")
23+
self.set_content_to_default(nested=False)
24+
self.highlight('iframe[title="Iframe Example"]')
25+
self.set_content_to_default()
26+
self.click("button#runbtn")
27+
self.highlight("#iframeResult")

examples/upload_file_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
class FileUploadButtonTests(BaseCase):
88
def test_file_upload_button(self):
9-
self.open(
10-
"https://www.w3schools.com/jsref/tryit.asp"
11-
"?filename=tryjsref_fileupload_get"
12-
)
9+
self.open("https://seleniumbase.io/w3schools/file_upload")
1310
self.set_content_to_frame("iframeResult")
1411
zoom_in = 'input[type="file"]{zoom: 1.6;-moz-transform: scale(1.6);}'
1512
self.add_css_style(zoom_in)

0 commit comments

Comments
 (0)