Skip to content

Commit 3c0829a

Browse files
committed
Update examples
1 parent 6b66a06 commit 3c0829a

File tree

2 files changed

+72
-14
lines changed

2 files changed

+72
-14
lines changed

examples/presenter/ReadMe.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
# 📰 Presenter 📰
44

5-
SeleniumBase Presenter allows you to create an HTML presentation with only a few lines of Python.
5+
SeleniumBase Presenter allows you to create HTML presentations with Python.
66
The Reveal-JS library is used for running the presentations.
77

88
**Here's a sample presentation:**
99

10-
<img width="500" src="https://seleniumbase.io/other/presenter.gif" title="Screenshot"><br>
10+
<a href="https://seleniumbase.io/other/presenter.html"><img width="500" src="https://seleniumbase.io/other/presenter.gif" title="Screenshot"></a><br>
1111

1212
Slides can include HTML, code, images, and iframes.
1313

@@ -142,7 +142,7 @@ class MyPresenterClass(BaseCase):
142142
' self.assert_text("free to copy and reuse")\n'
143143
' self.go_back()\n'
144144
' self.click_link_text("About")\n'
145-
' self.assert_exact_text("xkcd.com", "h2")\n'))
145+
' self.assert_exact_text("xkcd.com", "h2")'))
146146
self.add_slide(
147147
"<h3>Highlight <b>code</b> in slides:</h3>",
148148
code=(
@@ -151,22 +151,51 @@ class MyPresenterClass(BaseCase):
151151
' def test_basic(self):\n'
152152
' self.open("https://store.xkcd.com/search")\n'
153153
' self.type(\'input[name="q"]\', "xkcd book\\n")\n'
154-
' self.assert_text("xkcd: volume 0", "h3")\n'))
154+
' self.assert_text("xkcd: volume 0", "h3")'))
155155
self.add_slide(
156156
'<h3>Add <b>iFrames</b> to slides:</h3>',
157157
iframe="https://seleniumbase.io/demo_page")
158+
self.add_slide(
159+
'<h3>Getting started is <b>easy</b>:</h3>',
160+
code=(
161+
'from seleniumbase import BaseCase\n\n'
162+
'class MyPresenterClass(BaseCase):\n\n'
163+
' def test_presenter(self):\n'
164+
' self.create_presentation()\n'
165+
' self.add_slide("Welcome to Presenter!")\n'
166+
' self.add_slide(\n'
167+
' "Add code to slides:",\n'
168+
' code=(\n'
169+
' "from seleniumbase import BaseCase\\n\\n"\n'
170+
' "class MyPresenterClass(BaseCase):\\n\\n"\n'
171+
' " def test_presenter(self):\\n"\n'
172+
' " self.create_presentation()\\n"))\n'
173+
' self.begin_presentation(filename="demo.html")'))
158174
self.add_slide(
159175
'<h3>Include <b>notes</b> with slides:</h3><br />',
160176
code=('self.add_slide("[Your HTML goes here]",\n'
161177
' code="[Your software code goes here]",\n'
162178
' content2="[Additional HTML goes here]",\n'
163-
' notes="[Attached speaker notes go here]")'),
164-
content2='<h4>(Example Presenter Usage)</h4>',
165-
notes='<h2><ul><li>Note A!<li>Note B!<li>Note C!<li>Note D!</h2>')
179+
' notes="[Attached speaker notes go here]"\n'
180+
' "[Note A! -- Note B! -- Note C! ]")'),
181+
notes='<h2><ul><li>Note A!<li>Note B!<li>Note C!<li>Note D!</h2>',
182+
content2="<h4>(Notes can include HTML tags)</h4>")
183+
self.add_slide(
184+
'<h3>Multiple <b>themes</b> available:</h3>',
185+
code=(
186+
'self.create_presentation(theme="serif")\n\n'
187+
'self.create_presentation(theme="sky")\n\n'
188+
'self.create_presentation(theme="simple")\n\n'
189+
'self.create_presentation(theme="white")\n\n'
190+
'self.create_presentation(theme="moon")\n\n'
191+
'self.create_presentation(theme="black")\n\n'
192+
'self.create_presentation(theme="night")\n\n'
193+
'self.create_presentation(theme="beige")\n\n'
194+
'self.create_presentation(theme="league")'))
166195
self.add_slide(
167196
'<h2><b>The End</b></h2>',
168197
image="https://seleniumbase.io/img/sb_logo_10.png")
169-
self.begin_presentation(filename="my_presentation.html", interval=0)
198+
self.begin_presentation(filename="presenter.html", interval=0)
170199
```
171200

172201
#### This example is from [my_presentation.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/my_presentation.py), which you can run from the ``examples/presenter`` folder with the following command:

examples/presenter/my_presentation.py

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_presenter(self):
5656
' self.assert_text("free to copy and reuse")\n'
5757
' self.go_back()\n'
5858
' self.click_link_text("About")\n'
59-
' self.assert_exact_text("xkcd.com", "h2")\n'))
59+
' self.assert_exact_text("xkcd.com", "h2")'))
6060
self.add_slide(
6161
"<h3>Highlight <b>code</b> in slides:</h3>",
6262
code=(
@@ -65,19 +65,48 @@ def test_presenter(self):
6565
' def test_basic(self):\n'
6666
' self.open("https://store.xkcd.com/search")\n'
6767
' self.type(\'input[name="q"]\', "xkcd book\\n")\n'
68-
' self.assert_text("xkcd: volume 0", "h3")\n'))
68+
' self.assert_text("xkcd: volume 0", "h3")'))
6969
self.add_slide(
7070
'<h3>Add <b>iFrames</b> to slides:</h3>',
7171
iframe="https://seleniumbase.io/demo_page")
72+
self.add_slide(
73+
'<h3>Getting started is <b>easy</b>:</h3>',
74+
code=(
75+
'from seleniumbase import BaseCase\n\n'
76+
'class MyPresenterClass(BaseCase):\n\n'
77+
' def test_presenter(self):\n'
78+
' self.create_presentation()\n'
79+
' self.add_slide("Welcome to Presenter!")\n'
80+
' self.add_slide(\n'
81+
' "Add code to slides:",\n'
82+
' code=(\n'
83+
' "from seleniumbase import BaseCase\\n\\n"\n'
84+
' "class MyPresenterClass(BaseCase):\\n\\n"\n'
85+
' " def test_presenter(self):\\n"\n'
86+
' " self.create_presentation()\\n"))\n'
87+
' self.begin_presentation(filename="demo.html")'))
7288
self.add_slide(
7389
'<h3>Include <b>notes</b> with slides:</h3><br />',
7490
code=('self.add_slide("[Your HTML goes here]",\n'
7591
' code="[Your software code goes here]",\n'
7692
' 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>')
93+
' notes="[Attached speaker notes go here]"\n'
94+
' "[Note A! -- Note B! -- Note C! ]")'),
95+
notes='<h2><ul><li>Note A!<li>Note B!<li>Note C!<li>Note D!</h2>',
96+
content2="<h4>(Notes can include HTML tags)</h4>")
97+
self.add_slide(
98+
'<h3>Multiple <b>themes</b> available:</h3>',
99+
code=(
100+
'self.create_presentation(theme="serif")\n\n'
101+
'self.create_presentation(theme="sky")\n\n'
102+
'self.create_presentation(theme="simple")\n\n'
103+
'self.create_presentation(theme="white")\n\n'
104+
'self.create_presentation(theme="moon")\n\n'
105+
'self.create_presentation(theme="black")\n\n'
106+
'self.create_presentation(theme="night")\n\n'
107+
'self.create_presentation(theme="beige")\n\n'
108+
'self.create_presentation(theme="league")'))
80109
self.add_slide(
81110
'<h2><b>The End</b></h2>',
82111
image="https://seleniumbase.io/img/sb_logo_10.png")
83-
self.begin_presentation(filename="my_presentation.html", interval=0)
112+
self.begin_presentation(filename="presenter.html", interval=0)

0 commit comments

Comments
 (0)