Skip to content

Commit 2d09587

Browse files
committed
Update examples
1 parent 9d98cf1 commit 2d09587

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

examples/test_demo_site.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ def test_demo_site(self):
2222
# Verify that a hover dropdown link changes page text
2323
self.assert_text("Automation Practice", "h3")
2424
try:
25-
self.hover_and_click("#myDropdown", "#dropOption2")
25+
self.hover_and_click(
26+
"#myDropdown", "#dropOption2", timeout=2)
2627
except Exception:
27-
# If the user moves the mouse while the test runs
28+
# If a human moves the mouse while the test runs
2829
self.js_click("#dropOption2")
2930
self.assert_text("Link Two Selected", "h3")
3031

@@ -107,6 +108,11 @@ def test_demo_site(self):
107108
# Highlight a page element (Also asserts visibility)
108109
self.highlight("h2")
109110

111+
# Actions with Demo Mode enabled
112+
self.demo_mode = True
113+
self.type("input", "Have a Nice Day!")
114+
self.assert_text("SeleniumBase", "h2")
115+
110116
# Assert no broken links (Can be slow if many links)
111117
# self.assert_no_404_errors()
112118

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,12 @@ def main():
337337
data.append(' self.type("textarea.area1", "Testing Time!\\n")')
338338
data.append(' self.type(\'[name="preText2"]\', "Typing Text!")')
339339
data.append(' self.assert_text("Automation Practice", "h3")')
340-
data.append(' self.hover_and_click("#myDropdown", "#dropOption2")')
340+
data.append(" try:")
341+
data.append(" self.hover_and_click(")
342+
data.append(' "#myDropdown", "#dropOption2", timeout=2)')
343+
data.append(" except Exception:")
344+
data.append(" # If a human moves the mouse while the test runs")
345+
data.append(' self.js_click("#dropOption2")')
341346
data.append(' self.assert_text("Link Two Selected", "h3")')
342347
data.append(' self.assert_text("This Text is Green", "#pText")')
343348
data.append(' self.click("#myButton")')
@@ -393,6 +398,9 @@ def main():
393398
data.append(' self.click_link("SeleniumBase Demo Page")')
394399
data.append(' self.assert_exact_text("Demo Page", "h1")')
395400
data.append(' self.highlight("h2")')
401+
data.append(" self.demo_mode = True")
402+
data.append(' self.type("input", "Have a Nice Day!")')
403+
data.append(' self.assert_text("SeleniumBase", "h2")')
396404
data.append("")
397405
file_path = "%s/%s" % (dir_name, "test_demo_site.py")
398406
file = codecs.open(file_path, "w+", "utf-8")

0 commit comments

Comments
 (0)