Skip to content

Commit 7b56a1a

Browse files
authored
Merge pull request #645 from seleniumbase/demo-mode-updates-and-more
Demo Mode updates and more
2 parents 194436e + b41aa31 commit 7b56a1a

20 files changed

+154
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Tests are run with "pytest". Browsers are controlled by WebDriver.
2828

2929
<p align="center">
3030
<a href="#python_installation">🚀 Start</a> |
31-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">🧙‍♂️ Options</a> |
31+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">🧙‍♂️ cmd</a> |
3232
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md">🏰 Features</a> |
3333
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">👨‍🏫 Examples</a>
3434
<br />
@@ -40,7 +40,7 @@ Tests are run with "pytest". Browsers are controlled by WebDriver.
4040
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/translations.md">🌎 Translate</a> |
4141
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md">🗺️ Tours</a> |
4242
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md">🤖 CI</a> |
43-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md">🖼️ VisualTesting</a>
43+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md">🖼️ VisualTests</a>
4444
<br />
4545
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/ReadMe.md">📰 Presenter</a> |
4646
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md">📊 Chart Maker</a> |

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
livereload==2.6.2;python_version>="3.6"
22
mkdocs==1.1.2
3-
mkdocs-material==5.5.2
3+
mkdocs-material==5.5.3
44
mkdocs-simple-hooks==0.1.1
55
mkdocs-material-extensions==1.0
66
mkdocs-minify-plugin==0.3.0

help_docs/customizing_test_runs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Customizing test runs</h2>
3+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Command-line options</h2>
44

55
You can customize test runs from the command-line thanks to [SeleniumBase's pytest plugin](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py), which adds command-line options for setting/enabling the browser type, headless mode, mobile mode, multithreading mode, demo mode, proxy config, user agent config, browser extensions, and more.
66

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ nav:
7373
- Console Scripts: seleniumbase/console_scripts/ReadMe.md
7474
- JS Package Manager: help_docs/js_package_manager.md
7575
- Site Tours: examples/tour_examples/ReadMe.md
76-
- Presenter: examples/presenter/ReadMe.md
76+
- Presentation Maker: examples/presenter/ReadMe.md
7777
- Chart Maker: help_docs/chart_maker.md
7878
- Visual Testing: examples/visual_testing/ReadMe.md
7979
- Integrations:

requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pip>=20.2
1+
pip>=20.2.1
22
packaging>=20.4
33
setuptools>=44.1.1;python_version<"3.5"
44
setuptools>=49.2.1;python_version>="3.5"
@@ -38,6 +38,9 @@ cryptography==3.0
3838
pyopenssl==19.1.0
3939
pygments==2.5.2;python_version<"3.5"
4040
pygments==2.6.1;python_version>="3.5"
41+
ipython==5.10.0;python_version<"3.5"
42+
ipython==6.5.0;python_version>="3.5" and python_version<"3.7"
43+
ipython==7.17.0;python_version>="3.7"
4144
colorama==0.4.3
4245
pymysql==0.10.0
4346
coverage==5.2.1

seleniumbase/core/browser_launcher.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ def _create_firefox_profile(
273273
profile.set_preference("app.update.silent", True)
274274
profile.set_preference("browser.privatebrowsing.autostart", True)
275275
profile.set_preference("devtools.errorconsole.enabled", False)
276+
profile.set_preference("dom.webnotifications.enabled", False)
277+
profile.set_preference("dom.disable_beforeunload", True)
278+
profile.set_preference("browser.contentblocking.database.enabled", False)
276279
profile.set_preference("extensions.allowPrivateBrowsingByDefault", True)
277280
profile.set_preference("extensions.PrivateBrowsing.notification", False)
278281
profile.set_preference("extensions.systemAddon.update.enabled", False)

seleniumbase/core/style_sheet.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@
133133
font-family: "Proxima Nova","proxima-nova",Arial,sans-serif !important;
134134
font-size: 17px;
135135
}
136+
ul.messenger-theme-flat {
137+
box-shadow: 1px 2px 5px 2px rgba(0, 120, 120, 0.34),
138+
2px 2px 12px 1px rgba(0, 120, 120, 0.28) !important;
139+
}
136140
''')
137141

138142
sh_style_test = (

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def __init__(self, *args, **kwargs):
9898
def open(self, url):
9999
""" Navigates the current browser window to the specified page. """
100100
self.__last_page_load_url = None
101+
js_utils.clear_out_console_logs(self.driver)
101102
if url.startswith("://"):
102103
# Convert URLs such as "://google.com" into "https://google.com"
103104
url = "https" + url
@@ -424,6 +425,7 @@ def submit(self, selector, by=By.CSS_SELECTOR):
424425

425426
def refresh_page(self):
426427
self.__last_page_load_url = None
428+
js_utils.clear_out_console_logs(self.driver)
427429
self.driver.refresh()
428430
self.wait_for_ready_state_complete()
429431

@@ -3275,6 +3277,7 @@ def create_presentation(
32753277
new_presentation = (
32763278
'<html>\n'
32773279
'<head>\n'
3280+
'<meta charset="utf-8">\n'
32783281
'<link rel="stylesheet" href="%s">\n'
32793282
'<link rel="stylesheet" href="%s">\n'
32803283
'<style>\n'
@@ -3903,7 +3906,7 @@ def save_chart(self, chart_name=None, filename=None):
39033906
raise Exception("Chart {%s} does not exist!" % chart_name)
39043907
if not filename.endswith('.html'):
39053908
raise Exception('Chart file must end in ".html"!')
3906-
the_html = ""
3909+
the_html = '<meta charset="utf-8">\n'
39073910
for chart_data_point in self._chart_data[chart_name]:
39083911
the_html += chart_data_point
39093912
the_html += (
@@ -4568,7 +4571,7 @@ def set_messenger_theme(self, theme="default", location="default",
45684571
"bottom_left", "bottom_center", "bottom_right"]
45694572
max_messages is the limit of concurrent messages to display. """
45704573
if not theme:
4571-
theme = "default" # "future"
4574+
theme = "default" # "flat"
45724575
if not location:
45734576
location = "default" # "bottom_right"
45744577
if not max_messages:

seleniumbase/fixtures/js_utils.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def activate_messenger(driver):
476476
msg_style = ("Messenger.options = {'maxMessages': 8, "
477477
"extraClasses: 'messenger-fixed "
478478
"messenger-on-bottom messenger-on-right', "
479-
"theme: 'future'}")
479+
"theme: 'flat'}")
480480

481481
add_js_link(driver, jquery_js)
482482
wait_for_jquery_active(driver, timeout=0.2)
@@ -509,7 +509,7 @@ def activate_messenger(driver):
509509
def set_messenger_theme(driver, theme="default", location="default",
510510
max_messages="default"):
511511
if theme == "default":
512-
theme = "future"
512+
theme = "flat"
513513
if location == "default":
514514
location = "bottom_right"
515515
if max_messages == "default":
@@ -580,7 +580,7 @@ def post_messenger_success_message(driver, message, msg_dur):
580580
msg_dur = settings.DEFAULT_MESSAGE_DURATION
581581
msg_dur = float(msg_dur)
582582
try:
583-
theme = "future"
583+
theme = "flat"
584584
location = "bottom_right"
585585
if sb_config.mobile_emulator:
586586
theme = "block"
@@ -790,6 +790,15 @@ def get_drag_and_drop_script():
790790
return script
791791

792792

793+
def clear_out_console_logs(driver):
794+
try:
795+
# Clear out the current page log before navigating to a new page
796+
# (To make sure that assert_no_js_errors() uses current results)
797+
driver.get_log('browser')
798+
except Exception:
799+
pass
800+
801+
793802
@decorators.deprecated("Use re.escape() instead, which does what you want!")
794803
def _jq_format(code):
795804
"""

seleniumbase/translate/chinese.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,16 @@ def 导出游览(self, *args, **kwargs):
402402
# export_tour(name=None, filename="my_tour.js", url=None)
403403
return self.export_tour(*args, **kwargs)
404404

405+
def 获取PDF文本(self, *args, **kwargs):
406+
# get_pdf_text(pdf, page=None, maxpages=None, password=None,
407+
# codec='utf-8', wrap=False, nav=False, override=False)
408+
return self.get_pdf_text(*args, **kwargs)
409+
410+
def 断言PDF文本(self, *args, **kwargs):
411+
# assert_pdf_text(pdf, text, page=None, maxpages=None, password=None,
412+
# codec='utf-8', wrap=True, nav=False, override=False)
413+
return self.assert_pdf_text(*args, **kwargs)
414+
405415
def 失败(self, *args, **kwargs):
406416
# fail(msg=None) # Inherited from "unittest"
407417
return self.fail(*args, **kwargs)

0 commit comments

Comments
 (0)