Skip to content

Commit 1125dcb

Browse files
committed
Update examples
1 parent 6afab5b commit 1125dcb

File tree

2 files changed

+52
-25
lines changed

2 files changed

+52
-25
lines changed

examples/presenter/my_presentation.py

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,44 @@
44
class MyPresenterClass(BaseCase):
55

66
def test_presenter(self):
7-
self.create_presentation()
7+
self.create_presentation(theme="serif")
88
self.add_slide(
9-
"<h2>Welcome!</h2>"
10-
"<h4>Enjoy the Presentation!</h4>")
9+
'<h1>Welcome</h1><br />\n'
10+
'<h3>Press the <b>Right Arrow</b></h3>')
1111
self.add_slide(
12-
'<h3>SeleniumBase "Presenter"</h3>'
13-
'<img src="https://seleniumbase.io/img/logo3a.png"></img>'
14-
'<h4>A tool for creating presentations</h4>')
12+
'<h3>SeleniumBase Presenter</h3><br />\n'
13+
'<img width="240" src="https://seleniumbase.io/img/logo3a.png" />'
14+
'<span style="margin:144px;" />'
15+
'<img src="https://seleniumbase.io/other/python_3d_logo.png" />'
16+
'<br /><br />\n<h4>Create presentations with <b>Python</b></h4>')
1517
self.add_slide(
16-
'<h3>You can add HTML to any slide:</h3><br />'
17-
'<table style="padding:10px;border:4px solid black;font-size:60;">'
18-
'<tr><th>Row 1</th><th>Row 2</th></tr>'
19-
'<tr><td>Value 1</td><td>Value 2</td></tr></table><br />'
20-
'<h4>(HTML table example)</h4>')
18+
'<h3>Make slides using <b>HTML</b>:</h3><br />\n'
19+
'<table style="padding:10px;border:4px solid black;font-size:50;">'
20+
'\n<tr style="background-color:CDFFFF;">\n'
21+
'<th>Row ABC</th><th>Row XYZ</th></tr>\n'
22+
'<tr style="background-color:DCFDDC;">'
23+
'<td>Value ONE</td><td>Value TWO</td></tr>\n'
24+
'<tr style="background-color:DFDFFB;">\n'
25+
'<td>Value THREE</td><td>Value FOUR</td></tr>\n'
26+
'</table><br />\n<h4>(HTML <b>table</b> example)</h4>')
2127
self.add_slide(
22-
"<h3>You can display code:</h3>",
28+
'<h3>Keyboard Shortcuts:</h3>\n'
29+
'<table style="padding:10px;border:4px solid black;font-size:30;'
30+
'background-color:FFFFDD;">\n'
31+
'<tr><th>Key</th><th>Action</th></tr>\n'
32+
'<tr><td><b>=></b></td><td>Next Slide (N also works)</td></tr>\n'
33+
'<tr><td><b><=</b></td><td>Previous Slide (P also works)</td></tr>'
34+
'\n<tr><td>F</td><td>Full Screen Mode</td></tr>\n'
35+
'<tr><td>O</td><td>Overview Mode Toggle</td></tr>\n'
36+
'<tr><td>esc</td><td>Exit Full Screen / Overview Mode</td></tr>\n'
37+
'<tr><td><b>.</b></td><td>Pause/Resume Toggle</td></tr>\n'
38+
'<tr><td>space</td><td>Next Slide (alternative)</td></tr></table>'
39+
)
40+
self.add_slide(
41+
'<h3>Add <b>images</b> to slides:</h3>',
42+
image="https://seleniumbase.io/other/seagulls.jpg")
43+
self.add_slide(
44+
'<h3>Add <b>code</b> to slides:</h3>',
2345
code=(
2446
'from seleniumbase import BaseCase\n\n'
2547
'class MyTestClass(BaseCase):\n\n'
@@ -36,21 +58,26 @@ def test_presenter(self):
3658
' self.click_link_text("About")\n'
3759
' self.assert_exact_text("xkcd.com", "h2")\n'))
3860
self.add_slide(
39-
"<h3>You can highlight code:</h3>",
61+
"<h3>Highlight <b>code</b> in slides:</h3>",
4062
code=(
4163
'from seleniumbase import BaseCase\n\n'
4264
'<mark>class MyTestClass(BaseCase):</mark>\n\n'
4365
' def test_basic(self):\n'
4466
' self.open("https://store.xkcd.com/search")\n'
45-
' self.type(\'input[name="q"]\', "xkcd book\\n")\n'))
67+
' self.type(\'input[name="q"]\', "xkcd book\\n")\n'
68+
' self.assert_text("xkcd: volume 0", "h3")\n'))
4669
self.add_slide(
47-
"<h3>You can add notes to slides:</h3>",
48-
notes="<h2><ul><li>Note A!<li>Note B!<li>Note C!<li>Note D!</h2>")
70+
'<h3>Add <b>iFrames</b> to slides:</h3>',
71+
iframe="https://seleniumbase.io/demo_page")
4972
self.add_slide(
50-
"<h3>You can add images to slides:</h3>",
51-
image="https://seleniumbase.io/img/sb_logo_10.png")
73+
'<h3>Include <b>notes</b> with slides:</h3><br />',
74+
code=('self.add_slide("[Your HTML goes here]",\n'
75+
' code="[Your software code goes here]",\n'
76+
' content2="[Additional HTML goes here]",\n'
77+
' notes="[Attached speaker notes go here]")'),
78+
content2='<h4>(Example Presenter Usage)</h4>',
79+
notes='<h2><ul><li>Note A!<li>Note B!<li>Note C!<li>Note D!</h2>')
5280
self.add_slide(
53-
"<h3>You can add iframes to slides:</h3>",
54-
iframe="https://seleniumbase.io/demo_page")
55-
self.add_slide("<h1>The End</h1>")
56-
self.begin_presentation()
81+
'<h2><b>The End</b></h2>',
82+
image="https://seleniumbase.io/img/sb_logo_10.png")
83+
self.begin_presentation(filename="my_presentation.html", interval=0)

examples/test_demo_site.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ def test_demo_site(self):
9494
# Assert exact text
9595
self.assert_exact_text("Demo Page", "h1")
9696

97-
# Assert no broken links
98-
self.assert_no_404_errors()
97+
# Assert no broken links (Can be slow if many links)
98+
# self.assert_no_404_errors()
9999

100-
# Assert no JavaScript errors
100+
# Assert no JavaScript errors (Can also detect 404s)
101101
self.assert_no_js_errors()

0 commit comments

Comments
 (0)