Skip to content

Commit 39cf213

Browse files
authored
Merge pull request #2212 from seleniumbase/different-updates
Different updates
2 parents b6221cf + 945bf22 commit 39cf213

25 files changed

+856
-328
lines changed

.github/workflows/python-nightly-mac.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
fail-fast: false
1717
max-parallel: 6
1818
matrix:
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
19+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Set up Python ${{ matrix.python-version }}
2424
uses: actions/setup-python@v4
2525
with:

.github/workflows/python-nightly-ubuntu.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
fail-fast: false
1717
max-parallel: 6
1818
matrix:
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
19+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Set up Python ${{ matrix.python-version }}
2424
uses: actions/setup-python@v4
2525
with:

.github/workflows/python-nightly-windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
fail-fast: false
1717
max-parallel: 6
1818
matrix:
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
19+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Set up Python ${{ matrix.python-version }}
2424
uses: actions/setup-python@v4
2525
with:

.github/workflows/python-package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2323

2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- name: Set up Python ${{ matrix.python-version }}
2727
uses: actions/setup-python@v4
2828
with:

examples/edge_test.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@ def test_edge(self):
2323
self.assert_text("Microsoft Edge", 'img[srcset*="logo"] + div')
2424
self.highlight('img[srcset*="logo"] + div span:nth-of-type(1)')
2525
self.highlight('img[srcset*="logo"] + div span:nth-of-type(2)')
26-
self.highlight('span[aria-live="assertive"]')
26+
if self.is_element_visible('span[aria-live="assertive"]'):
27+
self.highlight('span[aria-live="assertive"]', loops=8)
28+
elif self.is_element_visible('a[href*="fwlink"]'):
29+
self.highlight('a[href*="fwlink"]', loops=8)
2730
self.highlight('a[href*="chromium"]')
31+
self.highlight('a[href*="credits"]')

examples/presenter/ReadMe.md

+39-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ cd examples/presenter
3636
pytest core_presentation.py
3737
```
3838

39-
4039
<h3><img src="https://seleniumbase.github.io/img/logo6.png" title="SeleniumBase" width="24" /> Creating a new presentation:</h3>
4140

4241
```python
@@ -59,7 +58,6 @@ If creating multiple presentations at the same time, you can pass the ``name`` p
5958
Notes are disabled by default. You can enable notes by specifying:
6059
``show_notes=True``
6160

62-
6361
<h3><img src="https://seleniumbase.github.io/img/logo6.png" title="SeleniumBase" width="24" /> Adding a slide to a presentation:</h3>
6462

6563
```python
@@ -243,6 +241,45 @@ Presentations automatically get saved when calling:
243241
self.begin_presentation(show_notes=True)
244242
```
245243

244+
<h3><img src="https://seleniumbase.github.io/img/logo6.png" title="SeleniumBase" width="24" /> Special abilities:</h3>
245+
246+
If you want to highlight multiple lines at different times in the same slide with the `<mark>` / `</mark>` tags, you can use the new `<mk-0>`-`</mk-0>`, `<mk-1>`-`</mk-1>` tags, which will generate multiple HTML slides from one Python slide.
247+
248+
Example:
249+
250+
```python
251+
self.add_slide(
252+
code=(
253+
<p><mk-0>Highlight this on the 1st generated slide</mk-0></p>
254+
<p><mk-1>Highlight this on the 2nd generated slide</mk-1></p>
255+
<p><mk-2>Highlight this on the 3rd generated slide</mk-2></p>
256+
<p><mk-3>Highlight this on the 4th generated slide</mk-3></p>
257+
)
258+
)
259+
```
260+
261+
Those should automatically get converted to `<mark>` ... `</mark>` on their turn:
262+
263+
Eg. First generated slide:
264+
265+
```html
266+
<p><mark>Highlight this on the first generated slide</mark></p>
267+
<p>Highlight this on the second generated slide</p>
268+
<p>Highlight this on the third generated slide</p>
269+
<p>Highlight this on the fourth generated slide></p>
270+
```
271+
272+
Eg. Second generated slide:
273+
274+
```html
275+
<p>Highlight this on the first generated slide</p>
276+
<p><mark>Highlight this on the second generated slide</mark></p>
277+
<p>Highlight this on the third generated slide</p>
278+
<p>Highlight this on the fourth generated slide></p>
279+
```
280+
281+
Etc...
282+
246283
--------
247284

248285
<h3 align="left"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="240" /></h3>

examples/presenter/edge_presentation.py

+25-133
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@ def test_presentation(self):
134134
self.highlight(
135135
'img[srcset*="logo"] + div span:nth-of-type(2)', loops=16
136136
)
137-
self.highlight('span[aria-live="assertive"]', loops=8)
137+
if self.is_element_visible('span[aria-live="assertive"]'):
138+
self.highlight('span[aria-live="assertive"]', loops=8)
139+
elif self.is_element_visible('a[href*="fwlink"]'):
140+
self.highlight('a[href*="fwlink"]', loops=8)
138141
self.highlight('a[href*="chromium"]')
142+
self.highlight('a[href*="credits"]')
139143
self.quit_extra_driver()
140144

141145
self.switch_to_default_driver()
@@ -231,96 +235,16 @@ def test_presentation(self):
231235
"<p>What are some building blocks?</p>\n"
232236
"<hr /><br />\n",
233237
code=(
234-
"<mark>from selenium import webdriver</mark>\n\n"
235-
"driver = webdriver.Edge()\n\n"
236-
'driver.get("http://selenium.dev")\n\n'
237-
"element = driver.find_element"
238+
"<mk-0>from selenium import webdriver</mk-0>\n\n"
239+
"<mk-1>driver = webdriver.Edge()</mk-1>\n\n"
240+
'<mk-2>driver.get("http://selenium.dev")</mk-2>\n\n'
241+
"<mk-3>element = driver.find_element"
238242
'("css selector", "#docsearch span")\n\n'
239-
"element.click()\n\n"
240-
"elem_2 = driver.find_element"
243+
"element.click()</mk-3>\n\n"
244+
"<mk-4>elem_2 = driver.find_element"
241245
'("css selector", "#docsearch-input")\n\n'
242-
'elem_2.send_keys("Python")\n\n'
243-
"driver.quit()\n\n"
244-
),
245-
)
246-
self.add_slide(
247-
"<p>What are some building blocks?</p>\n"
248-
"<hr /><br />\n",
249-
code=(
250-
"from selenium import webdriver\n\n"
251-
"<mark>driver = webdriver.Edge()</mark>\n\n"
252-
'driver.get("http://selenium.dev")\n\n'
253-
"element = driver.find_element"
254-
'("css selector", "#docsearch span")\n\n'
255-
"element.click()\n\n"
256-
"elem_2 = driver.find_element"
257-
'("css selector", "#docsearch-input")\n\n'
258-
'elem_2.send_keys("Python")\n\n'
259-
"driver.quit()\n\n"
260-
),
261-
)
262-
self.add_slide(
263-
"<p>What are some building blocks?</p>\n"
264-
"<hr /><br />\n",
265-
code=(
266-
"from selenium import webdriver\n\n"
267-
"driver = webdriver.Edge()\n\n"
268-
'<mark>driver.get("http://selenium.dev")</mark>\n\n'
269-
"element = driver.find_element"
270-
'("css selector", "#docsearch span")\n\n'
271-
"element.click()\n\n"
272-
"elem_2 = driver.find_element"
273-
'("css selector", "#docsearch-input")\n\n'
274-
'elem_2.send_keys("Python")\n\n'
275-
"driver.quit()\n\n"
276-
),
277-
)
278-
self.add_slide(
279-
"<p>What are some building blocks?</p>\n"
280-
"<hr /><br />\n",
281-
code=(
282-
"from selenium import webdriver\n\n"
283-
"driver = webdriver.Edge()\n\n"
284-
'driver.get("http://selenium.dev")\n\n'
285-
"<mark>element = driver.find_element"
286-
'("css selector", "#docsearch span")\n\n'
287-
"element.click()</mark>\n\n"
288-
"elem_2 = driver.find_element"
289-
'("css selector", "#docsearch-input")\n\n'
290-
'elem_2.send_keys("Python")\n\n'
291-
"driver.quit()\n\n"
292-
),
293-
)
294-
self.add_slide(
295-
"<p>What are some building blocks?</p>\n"
296-
"<hr /><br />\n",
297-
code=(
298-
"from selenium import webdriver\n\n"
299-
"driver = webdriver.Edge()\n\n"
300-
'driver.get("http://selenium.dev")\n\n'
301-
"element = driver.find_element"
302-
'("css selector", "#docsearch span")\n\n'
303-
"element.click()\n\n"
304-
"<mark>elem_2 = driver.find_element"
305-
'("css selector", "#docsearch-input")\n\n'
306-
'elem_2.send_keys("Python")</mark>\n\n'
307-
"driver.quit()\n\n"
308-
),
309-
)
310-
self.add_slide(
311-
"<p>What are some building blocks?</p>\n"
312-
"<hr /><br />\n",
313-
code=(
314-
"from selenium import webdriver\n\n"
315-
"driver = webdriver.Edge()\n\n"
316-
'driver.get("http://selenium.dev")\n\n'
317-
"element = driver.find_element"
318-
'("css selector", "#docsearch span")\n\n'
319-
"element.click()\n\n"
320-
"elem_2 = driver.find_element"
321-
'("css selector", "#docsearch-input")\n\n'
322-
'elem_2.send_keys("Python")\n\n'
323-
"<mark>driver.quit()</mark>\n\n"
246+
'elem_2.send_keys("Python")</mk-4>\n\n'
247+
"<mk-5>driver.quit()</mk-5>\n\n"
324248
),
325249
)
326250
self.add_slide(
@@ -369,31 +293,17 @@ def test_presentation(self):
369293
"without extra libraries or frameworks?</p><hr />"
370294
"<p><br />\n"
371295
"The command statements can get a bit too long:</p>\n"
372-
"<p><code><mark>"
296+
"<p><code><mk-0>"
373297
"driver.find_element(By.CSS_SELECTOR, CSS_SELECTOR).click()"
374-
"</code></mark></p><br />"
298+
"</code></mk-0></p><br />"
375299
"<p>This is better:</p>"
376-
"<p><code>self.click(CSS_SELECTOR)</code><p><br />",
300+
"<p><code><mk-1>self.click(CSS_SELECTOR)</mk-1></code><p><br />",
377301
)
378302
self.add_slide(
379303
"<p>What are some disadvantages of using <b>raw</b> Selenium "
380-
"without extra libraries or frameworks?</p><hr />"
381-
"<p><br />\n"
382-
"The command statements can get a bit too long:</p>\n"
383-
"<p><code>"
384-
"driver.find_element(By.CSS_SELECTOR, CSS_SELECTOR).click()"
385-
"</code></p><br />"
386-
"<p>This is better:</p>"
387-
"<p><code><mark>self.click(CSS_SELECTOR)</mark></code><p><br />",
388-
)
389-
self.add_slide(
390-
"<p>What are some disadvantages of using <b>raw</b> Selenium "
391-
"without extra libraries or frameworks?</p><hr />"
392-
"<br /><mark>\n"
393-
"No HTML reports, dashboards, screenshots..."
394-
"</mark><br />"
395-
"<p>A test framework can provide those!</p>"
396-
"<br />",
304+
"without extra libraries or frameworks?</p><hr /><br />\n"
305+
"<mark>No HTML reports, dashboards, screenshots...</mark><br />"
306+
"<p>A test framework can provide those!</p><br />",
397307
)
398308
self.add_slide(
399309
"<h6>Raw Selenium disadvantages, continued...</h6><hr />"
@@ -402,34 +312,16 @@ def test_presentation(self):
402312
image="https://seleniumbase.io/cdn/img/dash_report.png",
403313
)
404314
self.add_slide(
405-
"<p>Raw Selenium disadvantages, continued...</p><hr />\n"
406-
"<br />\n"
407-
"<p><mark>It takes multiple lines of code to do simple tasks:"
408-
"</mark></p>\n"
409-
"<pre>\n"
315+
"<p>Raw Selenium disadvantages, continued...</p><hr />\n<br />\n"
316+
"<p><mk-0>It takes multiple lines of code to do simple tasks:"
317+
"</mk-0></p>\n<pre>\n"
410318
'element = driver.find_element("css selector", "#password")\n'
411319
"element.clear()\n"
412320
'element.send_keys("secret_sauce")\n'
413321
'element.submit()\n'
414-
"</pre>\n"
415-
"<br />\n"
416-
"<p>But with a framework, do all that in ONE line:</p>\n"
417-
'<pre>self.type("#password", "secret_sauce\\n")</pre>'
418-
)
419-
self.add_slide(
420-
"<p>Raw Selenium disadvantages, continued...</p><hr />\n"
421-
"<br />\n"
422-
"<p>It takes multiple lines of code to do simple tasks:</p>\n"
423-
"<pre>\n"
424-
'element = driver.find_element("css selector", "#password")\n'
425-
"element.clear()\n"
426-
'element.send_keys("secret_sauce")\n'
427-
'element.submit()\n'
428-
"</pre>\n"
429-
"<br />\n"
430-
"<p><mark>But with a framework, do all that in ONE line:"
431-
"</mark></p>\n"
432-
'<pre>self.type("#password", "secret_sauce\\n")</pre>'
322+
"</pre>\n<br />\n"
323+
"<p><mk-1>But with a framework, do all that in ONE line:</mk-1>"
324+
'</p>\n<pre>self.type("#password", "secret_sauce\\n")</pre>'
433325
)
434326
self.add_slide(
435327
"<p>What else can test frameworks provide?</p><hr />\n"

0 commit comments

Comments
 (0)