-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
my_presentation.py
138 lines (136 loc) · 6.47 KB
/
my_presentation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
class MyPresenterClass(BaseCase):
def test_presenter(self):
self.create_presentation(theme="serif", transition="none")
self.add_slide(
"<h1>Welcome</h1><br />\n" "<h3>Press the <b>Right Arrow</b></h3>"
)
self.add_slide(
"<h3>SeleniumBase Presenter</h3><br />\n"
'<img width="240" '
'src="https://seleniumbase.github.io/img/logo3a.png" />'
'<span style="margin:144px;" />'
'<img '
'src="https://seleniumbase.github.io/other/python_3d_logo.png" />'
"<br /><br />\n<h4>Create presentations with <b>Python</b></h4>"
)
self.add_slide(
"<h3>Make slides using <b>HTML</b>:</h3><br />\n"
'<table style="padding:10px;border:4px solid black;font-size:50;">'
'\n<tr style="background-color:CDFFFF;">\n'
"<th>Row ABC</th><th>Row XYZ</th></tr>\n"
'<tr style="background-color:DCFDDC;">'
"<td>Value ONE</td><td>Value TWO</td></tr>\n"
'<tr style="background-color:DFDFFB;">\n'
"<td>Value THREE</td><td>Value FOUR</td></tr>\n"
"</table><br />\n<h4>(HTML <b>table</b> example)</h4>"
)
self.add_slide(
"<h3>Keyboard Shortcuts:</h3>\n"
'<table style="padding:10px;border:4px solid black;font-size:30;'
'background-color:FFFFDD;">\n'
"<tr><th>Key</th><th>Action</th></tr>\n"
"<tr><td><b>=></b></td><td>Next Slide (N also works)</td></tr>\n"
"<tr><td><b><=</b></td><td>Previous Slide (P also works)</td></tr>"
"\n<tr><td>F</td><td>Full Screen Mode</td></tr>\n"
"<tr><td>O</td><td>Overview Mode Toggle</td></tr>\n"
"<tr><td>esc</td><td>Exit Full Screen / Overview Mode</td></tr>\n"
"<tr><td><b>.</b></td><td>Pause/Resume Toggle</td></tr>\n"
"<tr><td>space</td><td>Next Slide (alternative)</td></tr></table>"
)
self.add_slide(
"<h3>Add <b>images</b> to slides:</h3>",
image="https://seleniumbase.github.io/other/seagulls.jpg",
)
self.add_slide(
"<h3>Add <b>code</b> to slides:</h3>",
code=(
"from seleniumbase import BaseCase\n"
"BaseCase.main(__name__, __file__)\n\n"
"class MyTestClass(BaseCase):\n"
" def test_basics(self):\n"
' self.open("https://xkcd.com/353/")\n'
' self.assert_title("xkcd: Python")\n'
" self.assert_element('img[alt=\"Python\"]')\n"
" self.click('a[rel=\"license\"]')\n"
' self.assert_text("free to copy and reuse")\n'
" self.go_back()\n"
' self.click_link("About")\n'
' self.assert_exact_text("xkcd.com", "h2")'
),
)
self.add_slide(
"<h3>Highlight <b>code</b> in slides:</h3>",
code=(
"from seleniumbase import BaseCase\n"
"BaseCase.main(__name__, __file__)\n\n"
"<mark>class MyTestClass(BaseCase):</mark>\n"
" def test_basics(self):\n"
' self.open("https://xkcd.com/353/")\n'
' self.assert_title("xkcd: Python")\n'
" self.assert_element('img[alt=\"Python\"]')\n"
" self.click('a[rel=\"license\"]')\n"
' self.assert_text("free to copy and reuse")\n'
" self.go_back()\n"
' self.click_link("About")\n'
' self.assert_exact_text("xkcd.com", "h2")'
),
)
self.add_slide(
"<h3>Add <b>iFrames</b> to slides:</h3>",
iframe="https://seleniumbase.io/demo_page",
)
self.add_slide(
"<h3>Getting started is <b>easy</b>:</h3>",
code=(
"from seleniumbase import BaseCase\n"
"BaseCase.main(__name__, __file__)\n\n"
"class MyPresenterClass(BaseCase):\n"
" def test_presenter(self):\n"
' self.create_presentation(theme="serif")\n'
' self.add_slide("Welcome to Presenter!")\n'
" self.add_slide(\n"
' "Add code to slides:",\n'
" code=(\n"
' "from seleniumbase import BaseCase\\n\\n"\n'
' "class MyPresenterClass(BaseCase):\\n\\n"\n'
' " def test_presenter(self):\\n"\n'
' " self.create_presentation()\\n"))\n'
" self.begin_presentation(\n"
' filename="demo.html", show_notes=True)'
),
)
self.add_slide(
"<h3>Include <b>notes</b> with slides:</h3><br />",
code=(
'self.add_slide("[Your HTML goes here]",\n'
' code="[Your software code goes here]",\n'
' content2="[Additional HTML goes here]",\n'
' notes="[Attached speaker notes go here]"\n'
' "[Note A! -- Note B! -- Note C! ]")'
),
notes="<h2><ul><li>Note A!<li>Note B!<li>Note C!<li>Note D!</h2>",
content2="<h4>(Notes can include HTML tags)</h4>",
)
self.add_slide(
"<h3>Multiple <b>themes</b> available:</h3>",
code=(
'self.create_presentation(theme="serif")\n\n'
'self.create_presentation(theme="sky")\n\n'
'self.create_presentation(theme="simple")\n\n'
'self.create_presentation(theme="white")\n\n'
'self.create_presentation(theme="moon")\n\n'
'self.create_presentation(theme="black")\n\n'
'self.create_presentation(theme="night")\n\n'
'self.create_presentation(theme="beige")\n\n'
'self.create_presentation(theme="league")'
),
)
self.add_slide(
"<h2><b>The End</b></h2>",
image="https://seleniumbase.github.io/img/sb_logo_10.png",
)
self.begin_presentation(
filename="presenter.html", show_notes=True, interval=0
)