pypi package 'seleniumbase'

Popularity: Medium (more popular than 90% of all packages)
Description: A complete web automation framework for end-to-end testing.
Installation: pip install seleniumbase
Last version: 3.5.11 (Download)
Homepage: https://github.com/seleniumbase/SeleniumBase
Size: 465.85 kB
License: MIT
Keywords: pytest, automation, selenium, browser, testing, webdriver, sbase

Activity

Last modified: August 5, 2022 10:39 PM (6 days ago)
Versions released in one year: 165
Weekly downloads: 24,129
08/15/202110/31/202101/16/202204/03/202206/19/2022040,00080,000120,000160,000036912released versions / week
  • Versions released
  • Weekly downloads

What's new in version 3.5.11

Delta between version 3.5.10 and version 3.5.11

Source: Github
Commits:
  • a1046e33e0127cf12c63a189117f1816481c60b5, August 5, 2022 10:25 PM:
    Fix EdgeDriver Manager script from new updates
  • 5d5685f96c1621a3c03d0621ccc6e9c08d2e08e5, August 5, 2022 10:26 PM:
    Update the assert_text() exception message
  • 10887046bc59a0a1204429204093a5ef9ea24848, August 5, 2022 10:27 PM:
    Update the documentation
  • 785c578f34cf72a654cf85d2d263e9e4f7571ac9, August 5, 2022 10:28 PM:
    Version 3.5.11
  • d3abd575d75e6ea271afe6ce4bc2f617a88b1182, August 5, 2022 10:34 PM:
    Merge pull request #1447 from seleniumbase/edgedriver-manager-update-and-docs
    
    EdgeDriver Manager script update and docs
Files changed:
examples/behave_bdd/ReadMe.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> ๐Ÿ Behave test runner for SeleniumBase ๐Ÿ</h2>
2
 
3
  ๐Ÿ (Utilizes the [Behave BDD Python library](https://github.com/behave/behave). For more info, see the [Behave tutorial](https://behave.readthedocs.io/en/stable/tutorial.html) and read about [Behave's Gherkin model](https://behave.readthedocs.io/en/stable/gherkin.html).)
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐Ÿ Behave test runner for SeleniumBase ๐Ÿ
2
 
3
  ๐Ÿ (Utilizes the [Behave BDD Python library](https://github.com/behave/behave). For more info, see the [Behave tutorial](https://behave.readthedocs.io/en/stable/tutorial.html) and read about [Behave's Gherkin model](https://behave.readthedocs.io/en/stable/gherkin.html).)
4
 
examples/chart_maker/ReadMe.md CHANGED
@@ -1,6 +1,4 @@
1
- <h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="350" /></h3>
2
-
3
- <h2> ๐Ÿ“Š ChartMaker ๐Ÿ“ถ </h2>
4
 
5
  <p>SeleniumBase ChartMaker lets you use Python to generate HTML charts.</p>
6
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐Ÿ“Š ChartMaker ๐Ÿ“ถ
 
 
2
 
3
  <p>SeleniumBase ChartMaker lets you use Python to generate HTML charts.</p>
4
 
examples/dialog_boxes/ReadMe.md CHANGED
@@ -1,6 +1,4 @@
1
- <h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="320" /></h3>
2
-
3
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> ๐Ÿ›‚ Dialog Boxes ๐Ÿ›‚</h2>
4
 
5
  SeleniumBase Dialog Boxes let your users provide input in the middle of automation scripts.
6
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐Ÿ›‚ Dialog Boxes ๐Ÿ›‚
 
 
2
 
3
  SeleniumBase Dialog Boxes let your users provide input in the middle of automation scripts.
4
 
examples/presenter/ReadMe.md CHANGED
@@ -1,6 +1,4 @@
1
- [<img src="https://seleniumbase.io/cdn/img/sb_logo_10t.png" title="SeleniumBase" width="220">](https://github.com/seleniumbase/SeleniumBase/)
2
-
3
- <h1> ๐Ÿ“‘ Presenter ๐ŸŽž๏ธ </h1>
4
 
5
  <p>SeleniumBase Presenter (slide-maker) lets you use Python to generate HTML presentations.</p>
6
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐Ÿ“‘ Presenter ๐ŸŽž๏ธ
 
 
2
 
3
  <p>SeleniumBase Presenter (slide-maker) lets you use Python to generate HTML presentations.</p>
4
 
examples/tour_examples/ReadMe.md CHANGED
@@ -1,6 +1,6 @@
1
  <h3 align="left"><img src="https://seleniumbase.io/cdn/img/g_maps_tour.png" alt="SeleniumBase Tour" width="340" /></h3>
2
 
3
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Interactive Product Tours</h2>
4
 
5
  <p><b>Increase SaaS Product Adoption by 10x or more.</b></p>
6
 
1
  <h3 align="left"><img src="https://seleniumbase.io/cdn/img/g_maps_tour.png" alt="SeleniumBase Tour" width="340" /></h3>
2
 
3
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Interactive Product Tours
4
 
5
  <p><b>Increase SaaS Product Adoption by 10x or more.</b></p>
6
 
examples/translations/ReadMe.md CHANGED
@@ -1,7 +1,8 @@
1
  <a id="language_tests"></a>
2
- <h2>๐ŸŒ Translated Tests ๐Ÿˆบ</h2>
3
 
4
- <b>SeleniumBase</b> supports the following 10 languages: <i>English</i>, <i>Chinese</i>, <i>Dutch</i>, <i>French</i>, <i>Italian</i>, <i>Japanese</i>, <i>Korean</i>, <i>Portuguese</i>, <i>Russian</i>, and <i>Spanish</i>. (Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>])
 
 
5
 
6
  Multi-language tests run with **pytest** like other tests. Test methods have a one-to-one mapping to supported languages. Here's an example of a translated test:
7
 
1
  <a id="language_tests"></a>
 
2
 
3
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐ŸŒ Translated Tests ๐Ÿˆบ
4
+
5
+ <b>SeleniumBase</b> supports the following 10 languages: <i>English</i>, <i>Chinese</i>, <i>Dutch</i>, <i>French</i>, <i>Italian</i>, <i>Japanese</i>, <i>Korean</i>, <i>Portuguese</i>, <i>Russian</i>, and <i>Spanish</i>. (Examples can be found in <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>)
6
 
7
  Multi-language tests run with **pytest** like other tests. Test methods have a one-to-one mapping to supported languages. Here's an example of a translated test:
8
 
examples/visual_testing/ReadMe.md CHANGED
@@ -1,6 +1,6 @@
1
- <p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_logo_f6.png" alt="SeleniumBase" width="320" /></a></p>
2
 
3
- <h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Automated Visual Regression Testing</h2>
4
 
5
  Automated Visual Regression Testing can help you detect when the layout of a web page has changed. Instead of comparing pixels from screenshots, layout differences can be detected by comparing HTML tags and attributes with a baseline. If a change is detected, it could mean that something broke, the web page was redesigned, or dynamic content changed.
6
 
1
+ <p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_logo_f6.png" alt="SeleniumBase" width="330" /></a></p>
2
 
3
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Automated Visual Regression Testing
4
 
5
  Automated Visual Regression Testing can help you detect when the layout of a web page has changed. Instead of comparing pixels from screenshots, layout differences can be detected by comparing HTML tags and attributes with a baseline. If a change is detected, it could mean that something broke, the web page was redesigned, or dynamic content changed.
6
 
help_docs/ReadMe.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Help Docs</h2>
2
 
3
  <p align="left">
4
  <a href="https://seleniumbase.io/#python_installation">๐Ÿš Start</a> |
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Help Docs
2
 
3
  <p align="left">
4
  <a href="https://seleniumbase.io/#python_installation">๐Ÿš Start</a> |
help_docs/behave_gui.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> SeleniumBase Behave GUI / Commander ๐Ÿ๐ŸŽ–๏ธ</h2>
2
 
3
  ๐Ÿ๐ŸŽ–๏ธ The <b>SeleniumBase Behave GUI</b> lets you run <code>behave</code> scripts from a Desktop GUI.<br>
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Behave GUI / Commander ๐Ÿ๐ŸŽ–๏ธ
2
 
3
  ๐Ÿ๐ŸŽ–๏ธ The <b>SeleniumBase Behave GUI</b> lets you run <code>behave</code> scripts from a Desktop GUI.<br>
4
 
help_docs/chart_maker.md CHANGED
@@ -1,6 +1,4 @@
1
- <h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="350" /></h3>
2
-
3
- <h2> ๐Ÿ“Š ChartMaker ๐Ÿ“ถ </h2>
4
 
5
  <p>SeleniumBase ChartMaker lets you use Python to generate HTML charts.</p>
6
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐Ÿ“Š ChartMaker ๐Ÿ“ถ
 
 
2
 
3
  <p>SeleniumBase ChartMaker lets you use Python to generate HTML charts.</p>
4
 
help_docs/commander.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> SeleniumBase Commander ๐ŸŽ–๏ธ</h2>
2
 
3
  ๐ŸŽ–๏ธ <b>SeleniumBase Commander</b> lets you run <code>pytest</code> scripts from a Desktop GUI.<br>
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Commander ๐ŸŽ–๏ธ
2
 
3
  ๐ŸŽ–๏ธ <b>SeleniumBase Commander</b> lets you run <code>pytest</code> scripts from a Desktop GUI.<br>
4
 
help_docs/customizing_test_runs.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> pytest options for SeleniumBase</h2>
2
 
3
  ๐ŸŽ›๏ธ SeleniumBase's [pytest plugin](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py) lets you customize test runs from the CLI (Command-Line Interface), which adds options for setting/enabling the browser type, Dashboard Mode, Demo Mode, Headless Mode, Mobile Mode, Multi-threading Mode, Recorder Mode, reuse-session mode, proxy config, user agent config, browser extensions, html-report mode, and more.
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) pytest options for SeleniumBase
2
 
3
  ๐ŸŽ›๏ธ SeleniumBase's [pytest plugin](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py) lets you customize test runs from the CLI (Command-Line Interface), which adds options for setting/enabling the browser type, Dashboard Mode, Demo Mode, Headless Mode, Mobile Mode, Multi-threading Mode, Recorder Mode, reuse-session mode, proxy config, user agent config, browser extensions, html-report mode, and more.
4
 
help_docs/desired_capabilities.md CHANGED
@@ -1,4 +1,4 @@
1
- <h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Using Desired Capabilities</h3>
2
 
3
  You can specify browser capabilities when running SeleniumBase tests on a remote Selenium Grid server such as <a href="https://www.browserstack.com/automate/capabilities" target="_blank">BrowserStack</a>, <a href="https://www.lambdatest.com/capabilities-generator/" target="_blank">LambdaTest</a>, or <a href="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/" target="_blank">Sauce Labs</a>.
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Using Desired Capabilities
2
 
3
  You can specify browser capabilities when running SeleniumBase tests on a remote Selenium Grid server such as <a href="https://www.browserstack.com/automate/capabilities" target="_blank">BrowserStack</a>, <a href="https://www.lambdatest.com/capabilities-generator/" target="_blank">LambdaTest</a>, or <a href="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/" target="_blank">Sauce Labs</a>.
4
 
help_docs/features_list.md CHANGED
@@ -2,7 +2,8 @@
2
  <!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the tutorial on YouTube</a></b>)</p>
3
 
4
  <a id="feature_list"></a>
5
- <h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Features: ๐ŸŽฏ</h2>
 
6
 
7
  * A powerful Python framework for browser automation and E2E UI testing.
8
  * Includes [Recorder Mode](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md) for instantly generating browser tests in Python.
2
  <!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the tutorial on YouTube</a></b>)</p>
3
 
4
  <a id="feature_list"></a>
5
+
6
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Features: ๐ŸŽฏ
7
 
8
  * A powerful Python framework for browser automation and E2E UI testing.
9
  * Includes [Recorder Mode](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md) for instantly generating browser tests in Python.
help_docs/happy_customers.md CHANGED
@@ -1,3 +1,5 @@
 
 
1
  <h4> Here are some organizations that have grown their automation with SeleniumBase:</h4>
2
 
3
  * [MIT](https://web.mit.edu/)
1
+ <h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="300" /></h3>
2
+
3
  <h4> Here are some organizations that have grown their automation with SeleniumBase:</h4>
4
 
5
  * [MIT](https://web.mit.edu/)
help_docs/hidden_files_info.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Info about hidden files on macOS</h2>
2
 
3
  Depending on your macOS settings, some files may be hidden from view in your Finder window, such as ``.gitignore``. To view all files, run the following command and then reopen the Finder window:
4
 
1
+ ## Info about hidden files on macOS
2
 
3
  Depending on your macOS settings, some files may be hidden from view in your Finder window, such as ``.gitignore``. To view all files, run the following command and then reopen the Finder window:
4
 
help_docs/how_it_works.md CHANGED
@@ -1,7 +1,6 @@
1
- [<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
2
 
3
  <a id="how_seleniumbase_works"></a>
4
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> How it works:</h2>
5
 
6
  At the core, SeleniumBase works by extending [pytest](https://docs.pytest.org/en/latest/) as a direct plugin. SeleniumBase automatically spins up web browsers for tests (using Selenium WebDriver), and then gives those tests access to the SeleniumBase libraries through the [BaseCase class](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py). Tests are also given access to [SeleniumBase command-line arguments](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md) and [SeleniumBase methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md), which provide additional functionality.
7
 
@@ -19,6 +18,26 @@ Then have your test classes inherit BaseCase:
19
  class MyTestClass(BaseCase):
20
  ```
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  (See the example test, [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py), for reference.)
23
 
24
  --------
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) How SeleniumBase Works:
2
 
3
  <a id="how_seleniumbase_works"></a>
 
4
 
5
  At the core, SeleniumBase works by extending [pytest](https://docs.pytest.org/en/latest/) as a direct plugin. SeleniumBase automatically spins up web browsers for tests (using Selenium WebDriver), and then gives those tests access to the SeleniumBase libraries through the [BaseCase class](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py). Tests are also given access to [SeleniumBase command-line arguments](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md) and [SeleniumBase methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md), which provide additional functionality.
6
 
18
  class MyTestClass(BaseCase):
19
  ```
20
 
21
+ Here's what a full test might look like:
22
+
23
+ ```python
24
+ from seleniumbase import BaseCase
25
+
26
+ class TestMFALogin(BaseCase):
27
+ def test_mfa_login(self):
28
+ self.open("https://seleniumbase.io/realworld/login")
29
+ self.type("#username", "demo_user")
30
+ self.type("#password", "secret_pass")
31
+ self.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") # 6-digit
32
+ self.assert_text("Welcome!", "h1")
33
+ self.highlight("img#image1") # A fancier assert_element() call
34
+ self.click('a:contains("This Page")')
35
+ self.save_screenshot_to_logs() # In "./latest_logs/" folder.
36
+ self.click_link("Sign out") # Must be "a" tag. Not "button".
37
+ self.assert_element('a:contains("Sign in")')
38
+ self.assert_exact_text("You have been signed out!", "#top_message")
39
+ ```
40
+
41
  (See the example test, [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py), for reference.)
42
 
43
  --------
help_docs/html_inspector.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> The HTML Inspector ๐Ÿ”Ž</h2>
2
 
3
  ๐Ÿ”Ž <b>HTML Inspector</b> provides useful info about a web page.
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) The HTML Inspector ๐Ÿ”Ž
2
 
3
  ๐Ÿ”Ž <b>HTML Inspector</b> provides useful info about a web page.
4
 
help_docs/install.md CHANGED
@@ -1,6 +1,4 @@
1
- [<img src="https://seleniumbase.io/cdn/img/sb_logo_10t.png" title="SeleniumBase" width="220">](https://github.com/seleniumbase/SeleniumBase/)
2
-
3
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Installation</h2>
4
 
5
  <h4>If installing SeleniumBase directly from <a href="https://pypi.python.org/pypi/seleniumbase">PyPI</a>, (the Python Package Index), use:</h4>
6
 
@@ -54,4 +52,6 @@ pip install git+https://github.com/seleniumbase/SeleniumBase.git@master#egg=sele
54
 
55
  --------
56
 
57
- <a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" title="SeleniumBase" width="280" /></a>
 
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Installation
 
 
2
 
3
  <h4>If installing SeleniumBase directly from <a href="https://pypi.python.org/pypi/seleniumbase">PyPI</a>, (the Python Package Index), use:</h4>
4
 
52
 
53
  --------
54
 
55
+ [<img src="https://seleniumbase.io/cdn/img/sb_logo_10t.png" title="SeleniumBase" width="200">](https://github.com/seleniumbase/SeleniumBase/)
56
+
57
+ <a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" title="SeleniumBase" width="200" /></a>
help_docs/install_python_pip_git.md CHANGED
@@ -14,7 +14,7 @@ You can download Python from [https://www.python.org/downloads/](https://www.pyt
14
 
15
  ### [Pip](https://en.wikipedia.org/wiki/Pip_%28package_manager%29)
16
 
17
- You might already have pip and setuptools installed, but if you don't:
18
 
19
  ```bash
20
  python -m easy_install -U pip
14
 
15
  ### [Pip](https://en.wikipedia.org/wiki/Pip_%28package_manager%29)
16
 
17
+ You probably already have pip and setuptools installed. If not:
18
 
19
  ```bash
20
  python -m easy_install -U pip
help_docs/js_package_manager.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> JS Package Manager and Code Generators</h2>
2
 
3
  <h3>๐Ÿ•น๏ธ SeleniumBase lets you load JavaScript packages from any CDN link into any website.</h3>
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) JS Package Manager and Code Generators
2
 
3
  <h3>๐Ÿ•น๏ธ SeleniumBase lets you load JavaScript packages from any CDN link into any website.</h3>
4
 
help_docs/locale_codes.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="25" /> Language Locale Codes</h2>
2
 
3
  You can specify a Language Locale Code to customize web pages on supported websites. With SeleniumBase, you can change the web browser's Locale on the command line by doing this:
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Language Locale Codes
2
 
3
  You can specify a Language Locale Code to customize web pages on supported websites. With SeleniumBase, you can change the web browser's Locale on the command line by doing this:
4
 
help_docs/method_summary.md CHANGED
@@ -1,9 +1,9 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Methods (API Reference)</h2>
2
 
3
  <!-- YouTube View --><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA"><img src="https://seleniumbase.io/cdn/img/sb_api_youtube.png" title="SeleniumBase on YouTube" width="285" /></a>
4
  <!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA">Common API Methods on YouTube</a></b>)</p>
5
 
6
- Here's a list of SeleniumBase method definitions, which are defined in [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)
7
 
8
  For backwards compatibility, older versions of method names have remained to keep older scripts working. *(E.g: wait_for_element_visible was shortened to wait_for_element and then to find_element.)*
9
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Methods (API Reference)
2
 
3
  <!-- YouTube View --><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA"><img src="https://seleniumbase.io/cdn/img/sb_api_youtube.png" title="SeleniumBase on YouTube" width="285" /></a>
4
  <!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA">Common API Methods on YouTube</a></b>)</p>
5
 
6
+ Here's a list of SeleniumBase method definitions, which are defined in **[base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)**
7
 
8
  For backwards compatibility, older versions of method names have remained to keep older scripts working. *(E.g: wait_for_element_visible was shortened to wait_for_element and then to find_element.)*
9
 
help_docs/mobile_testing.md CHANGED
@@ -1,6 +1,4 @@
1
- <p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_text_f.png" alt="SeleniumBase" title="SeleniumBase" width="290" /></a></p>
2
-
3
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Mobile Testing</h2>
4
 
5
  Use ``--mobile`` to run SeleniumBase tests using Chrome's mobile device emulator with default values for Device Metrics and User-Agent.
6
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Mobile Testing
 
 
2
 
3
  Use ``--mobile`` to run SeleniumBase tests using Chrome's mobile device emulator with default values for Device Metrics and User-Agent.
4
 
help_docs/mysql_installation.md CHANGED
@@ -1,4 +1,4 @@
1
- <h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="25" /> MySQL Installation Instructions</h3>
2
 
3
 
4
  #### [MySQL](http://www.mysql.com/) (OPTIONAL)
1
+ ## MySQL Installation Instructions
2
 
3
 
4
  #### [MySQL](http://www.mysql.com/) (OPTIONAL)
help_docs/recorder_mode.md CHANGED
@@ -1,7 +1,7 @@
1
  <!-- YouTube View --><a href="https://www.youtube.com/watch?v=eKN5nq7YbdM"><img src="http://img.youtube.com/vi/eKN5nq7YbdM/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
2
  <!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=eKN5nq7YbdM">Watch the tutorial on YouTube</a></b>)</p>
3
 
4
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Recorder Mode</h2>
5
 
6
  ๐Ÿ”ด <b>SeleniumBase Recorder Mode</b> lets you record & export browser actions into test automation scripts.<br>
7
 
1
  <!-- YouTube View --><a href="https://www.youtube.com/watch?v=eKN5nq7YbdM"><img src="http://img.youtube.com/vi/eKN5nq7YbdM/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
2
  <!-- GitHub Only --><p>(<b><a href="https://www.youtube.com/watch?v=eKN5nq7YbdM">Watch the tutorial on YouTube</a></b>)</p>
3
 
4
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Recorder Mode
5
 
6
  ๐Ÿ”ด <b>SeleniumBase Recorder Mode</b> lets you record & export browser actions into test automation scripts.<br>
7
 
help_docs/shadow_dom.md CHANGED
@@ -1,4 +1,6 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Shadow DOM support / Shadow-root interaction</h2>
 
 
2
 
3
  ๐Ÿ”ต SeleniumBase lets you pierce through open Shadow DOM selectors (to interact with elements inside) by adding ``::shadow`` to CSS fragments that include a shadow-root element. For multi-layered shadow-roots, you must individually pierce through each shadow-root element that you want to get through.
4
 
1
+ <h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="300" /></h3>
2
+
3
+ ## Shadow DOM support / Shadow-root interaction
4
 
5
  ๐Ÿ”ต SeleniumBase lets you pierce through open Shadow DOM selectors (to interact with elements inside) by adding ``::shadow`` to CSS fragments that include a shadow-root element. For multi-layered shadow-roots, you must individually pierce through each shadow-root element that you want to get through.
6
 
help_docs/syntax_formats.md CHANGED
@@ -1,5 +1,6 @@
1
  <a id="syntax_formats"></a>
2
- <h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> The 20 syntax formats</h2>
 
3
 
4
  <b>SeleniumBase</b> supports 20 different syntax formats (<i>design patterns</i>) for structuring tests. (<i>The first 6 are the most common.</i>)
5
 
1
  <a id="syntax_formats"></a>
2
+
3
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) The 20 Syntax Formats
4
 
5
  <b>SeleniumBase</b> supports 20 different syntax formats (<i>design patterns</i>) for structuring tests. (<i>The first 6 are the most common.</i>)
6
 
help_docs/translations.md CHANGED
@@ -1,7 +1,8 @@
1
  <a id="language_tests"></a>
2
- <h2>๐ŸŒ Translated Tests ๐Ÿˆบ</h2>
3
 
4
- <b>SeleniumBase</b> supports the following 10 languages: <i>English</i>, <i>Chinese</i>, <i>Dutch</i>, <i>French</i>, <i>Italian</i>, <i>Japanese</i>, <i>Korean</i>, <i>Portuguese</i>, <i>Russian</i>, and <i>Spanish</i>. (Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>])
 
 
5
 
6
  Multi-language tests run with **pytest** like other tests. Test methods have a one-to-one mapping to supported languages. Here's an example of a translated test:
7
 
1
  <a id="language_tests"></a>
 
2
 
3
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐ŸŒ Translated Tests ๐Ÿˆบ
4
+
5
+ <b>SeleniumBase</b> supports the following 10 languages: <i>English</i>, <i>Chinese</i>, <i>Dutch</i>, <i>French</i>, <i>Italian</i>, <i>Japanese</i>, <i>Korean</i>, <i>Portuguese</i>, <i>Russian</i>, and <i>Spanish</i>. (Examples can be found in <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>)
6
 
7
  Multi-language tests run with **pytest** like other tests. Test methods have a one-to-one mapping to supported languages. Here's an example of a translated test:
8
 
help_docs/useful_grep_commands.md CHANGED
@@ -1,15 +1,17 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Useful grep commands</h2>
2
 
3
  There are several useful **grep** commands for helping you find and/or replace text in multiple files. Examples:
4
 
5
  #### List all files containing ``self.get_new_driver(``, ignoring ".pyc" files, from the current directory:
6
 
7
  ``grep -rl "self.get_new_driver(" * --exclude=\*.pyc``
8
-
9
  OR
10
-
11
  ``grep -rl * -e "self.get_new_driver(" --exclude=\*.pyc``
12
 
 
 
 
 
13
  --------
14
 
15
  #### Replace all occurrences of "foo_abc" with "bar_xyz" on Linux, for Python files from the current directory:
1
+ ## Useful grep commands
2
 
3
  There are several useful **grep** commands for helping you find and/or replace text in multiple files. Examples:
4
 
5
  #### List all files containing ``self.get_new_driver(``, ignoring ".pyc" files, from the current directory:
6
 
7
  ``grep -rl "self.get_new_driver(" * --exclude=\*.pyc``
 
8
  OR
 
9
  ``grep -rl * -e "self.get_new_driver(" --exclude=\*.pyc``
10
 
11
+ To only search ``.py`` files, use ``--include=\*.py``:
12
+
13
+ ``grep -rl "self.get_new_driver(" * --include=\*.py``
14
+
15
  --------
16
 
17
  #### Replace all occurrences of "foo_abc" with "bar_xyz" on Linux, for Python files from the current directory:
help_docs/using_safari_driver.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Using Safari's WebDriver for running browser tests on macOS</h2>
2
 
3
  *(NOTE: Safari's WebDriver requires macOS 10.13 "High Sierra" or later.)*
4
 
1
+ ## Using Safari's WebDriver for running browser tests on macOS
2
 
3
  *(NOTE: Safari's WebDriver requires macOS 10.13 "High Sierra" or later.)*
4
 
help_docs/verify_webdriver.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Verifying that web drivers are installed
2
 
3
  On newer versions of SeleniumBase, the driver is automatically downloaded to the ``seleniumbase/drivers`` folder, and does not need to be on the System Path when running tests.
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Verifying that web drivers are installed
2
 
3
  On newer versions of SeleniumBase, the driver is automatically downloaded to the ``seleniumbase/drivers`` folder, and does not need to be on the System Path when running tests.
4
 
help_docs/virtualenv_instructions.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Virtual Environment Tutorial</h2>
2
 
3
  There are multiple ways of creating a **[Python virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment)**. This tutorial covers two of those:
4
 
1
+ ## Virtual Environment Tutorial
2
 
3
  There are multiple ways of creating a **[Python virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment)**. This tutorial covers two of those:
4
 
help_docs/webdriver_installation.md CHANGED
@@ -1,8 +1,8 @@
1
- [<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
2
 
3
- <h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Installing webdrivers</h2>
4
 
5
- To run web automation, you'll need webdrivers for each browser you plan on using. Here are some commands that'll automatically download the driver you need into the SeleniumBase ``drivers`` folder once you've installed SeleniumBase:
6
 
7
  ```bash
8
  sbase install chromedriver
@@ -88,3 +88,5 @@ chmod +x /usr/local/bin/geckodriver
88
  ```
89
 
90
  * If you wish to verify that web drivers are working, **[follow these instructions](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/verify_webdriver.md)**.
 
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Installing webdrivers
2
 
3
+ To run web automation, you'll need webdrivers for each browser you plan on using. With SeleniumBase, drivers are downloaded automatically as needed into the SeleniumBase ``drivers`` folder.
4
 
5
+ You can also download drivers manually with these commands:
6
 
7
  ```bash
8
  sbase install chromedriver
88
  ```
89
 
90
  * If you wish to verify that web drivers are working, **[follow these instructions](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/verify_webdriver.md)**.
91
+
92
+ [<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="280">](https://github.com/seleniumbase/SeleniumBase)
seleniumbase/__version__.py CHANGED
@@ -1,2 +1,2 @@
1
  # seleniumbase package
2
- __version__ = "3.5.10"
1
  # seleniumbase package
2
+ __version__ = "3.5.11"
seleniumbase/console_scripts/ReadMe.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2>๐Ÿ”ฎ Console Scripts ๐Ÿ”ฎ</h2>
2
 
3
  โญ SeleniumBase console scripts help you get things done, such as getting web drivers, creating a test directory with useful files, activating the SeleniumBase Recorder, launching the SeleniumBase Commander, translating tests into other languages, running a Selenium Grid, and more.
4
 
1
+ ## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) ๐Ÿ”ฎ Console Scripts ๐Ÿ”ฎ
2
 
3
  โญ SeleniumBase console scripts help you get things done, such as getting web drivers, creating a test directory with useful files, activating the SeleniumBase Recorder, launching the SeleniumBase Commander, translating tests into other languages, running a Selenium Grid, and more.
4
 
seleniumbase/core/browser_launcher.py CHANGED
@@ -1851,7 +1851,10 @@ def get_local_driver(
1851
  except Exception as e:
1852
  auto_upgrade_edgedriver = False
1853
  edge_version = None
1854
- if "This version of MSEdgeDriver only supports" in e.msg:
 
 
 
1855
  if "Current browser version is " in e.msg:
1856
  auto_upgrade_edgedriver = True
1857
  edge_version = e.msg.split(
@@ -1906,7 +1909,10 @@ def get_local_driver(
1906
  except Exception as e:
1907
  auto_upgrade_edgedriver = False
1908
  edge_version = None
1909
- if "This version of MSEdgeDriver only supports" in e.msg:
 
 
 
1910
  if "Current browser version is " in e.msg:
1911
  auto_upgrade_edgedriver = True
1912
  edge_version = e.msg.split(
1851
  except Exception as e:
1852
  auto_upgrade_edgedriver = False
1853
  edge_version = None
1854
+ if (
1855
+ "This version of MSEdgeDriver only supports" in e.msg
1856
+ or "This version of Microsoft Edge WebDriver" in e.msg
1857
+ ):
1858
  if "Current browser version is " in e.msg:
1859
  auto_upgrade_edgedriver = True
1860
  edge_version = e.msg.split(
1909
  except Exception as e:
1910
  auto_upgrade_edgedriver = False
1911
  edge_version = None
1912
+ if (
1913
+ "This version of MSEdgeDriver only supports" in e.msg
1914
+ or "This version of Microsoft Edge WebDriver" in e.msg
1915
+ ):
1916
  if "Current browser version is " in e.msg:
1917
  auto_upgrade_edgedriver = True
1918
  edge_version = e.msg.split(
seleniumbase/fixtures/page_actions.py CHANGED
@@ -529,7 +529,7 @@ def wait_for_text_visible(
529
  full_text = full_text.replace("\n", "\\n ")
530
  message = (
531
  "Expected text substring {%s} for {%s} was not visible "
532
- "after %s second%s!\n (The string searched was {%s})"
533
  % (text, selector, timeout, plural, full_text)
534
  )
535
  timeout_exception(TextNotVisibleException, message)
529
  full_text = full_text.replace("\n", "\\n ")
530
  message = (
531
  "Expected text substring {%s} for {%s} was not visible "
532
+ "after %s second%s!\n (Actual string found was {%s})"
533
  % (text, selector, timeout, plural, full_text)
534
  )
535
  timeout_exception(TextNotVisibleException, message)

Readme

<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_logo_gs4.png" alt="SeleniumBase" title="SeleniumBase" width="420" /></a></p> <p align="center"><b>Scale your web app testing with <a href="https://www.selenium.dev/documentation/">Selenium</a>, <a href="https://www.python.org/about/">Python</a>, and <a href="https://docs.pytest.org/en/latest/how-to/usage.html">pytest</a>.</b></p><p align="center"><a href="https://pypi.python.org/pypi/seleniumbase" target="_blank"><img src="https://img.shields.io/pypi/v/seleniumbase.svg?color=3399EE" alt="PyPI version" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/releases" target="_blank"><img src="https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=22AAEE" alt="GitHub version" /></a> <a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/actions" target="_blank"><img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="SeleniumBase" /></a></p><p align="center"> <a href="#python_installation">๐Ÿš Start</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md">๐Ÿฐ Features</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">โœ… Examples</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">๐ŸŽ›๏ธ Options</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md">๐Ÿ”ฎ Scripts</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mobile_testing.md">๐Ÿ“ฑ Phone</a> <br /> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">๐Ÿ“™ APIs</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md">๐Ÿ“ Formats</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md">๐Ÿ”ต Dashboard</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md">๐Ÿ”ด Recorder</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">๐Ÿ—พ Locales</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">๐ŸŒ Grid</a> <br /> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/commander.md">๐ŸŽ–๏ธ GUI</a> | <a href="https://seleniumbase.io/demo_page">๐Ÿ“ฐ TestPage</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/translations.md">๐Ÿˆบ Translator</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/ReadMe.md">๐ŸŽž๏ธ Presenter</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md">๐Ÿ“Š Charts</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md">๐ŸšŽ Tours</a> <br /> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md">๐Ÿค– CI</a> | <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">โ™ป๏ธ Boilerplates</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/html_inspector.md">๐Ÿ”Ž Inspector</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/js_package_manager.md">๐Ÿ•น๏ธ JSCode</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/dialog_boxes/ReadMe.md">๐Ÿ›‚ Dialogs</a> | <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md">๐Ÿ–ผ๏ธ Visual</a> <br /> </p>
<p align="left"><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="22" /> An example of running a test with <b>pytest</b>: <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py">test_demo_site.py</a></p>
cd examples/
pytest test_demo_site.py --chrome
<p align="left"><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py" target="_blank"><img src="https://seleniumbase.io/cdn/gif/demo_page_4.gif" width="420" alt="SeleniumBase Example" title="SeleniumBase Example" /></a></p><div></div> <details> <summary> โ–ถ๏ธ How is SeleniumBase different from raw Selenium? (<b><u>click to expand</u></b>)</summary> <div><p>๐Ÿ’ก SeleniumBase is a Python test framework for the <a href="https://www.w3.org/TR/webdriver2/#endpoints" target="_blank">Selenium/WebDriver</a> browser automation library. This framework incorporates test-runners such as <code>pytest</code>, <code>nosetests</code>, and <code>behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>such as choosing the browser to use</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p><p>๐Ÿ’ก With raw Selenium, you have to manually download drivers (<i>eg. chromedriver</i>) before running tests. With SeleniumBase's driver manager, that's done automatically for you if the required driver isn't already on your PATH. There are also console scripts available for more control (eg. <code>sbase install chromedriver latest</code> to download the latest version of chromedriver to a local SeleniumBase directory).</p><p>๐Ÿ’ก With raw Selenium, commands that use selectors need to specify the type of selector (eg. <code>"css selector", "button#myButton"</code>). With SeleniumBase, there's auto-detection between CSS Selectors and XPath, which means you don't need to specify the type of selector in your commands (<i>but optionally you could</i>).</p><p>๐Ÿ’ก SeleniumBase methods often perform multiple actions in a single method call. For example, <code>self.type(selector,text)</code> does the following:<br />1. Waits for the element to be visible.<br />2. Waits for the element to be interactive.<br />3. Clears the text field.<br />4. Types in the new text.<br />5. Presses Enter/Submit if the text ends in "\n".<br />With raw Selenium, those actions require multiple method calls.</p><p>๐Ÿ’ก SeleniumBase uses default timeout values when not set, which means that methods automatically wait for elements to appear (<i>up to the timeout limit</i>) before failing:<br />โœ…<code>self.click("button")</code><br />With raw Selenium, methods would fail instantly (<i>by default</i>) if an element needed more time to load:<br />โŒ<code>self.driver.find_element(by="css selector", value="button").click()</code><br />(Reliable code is better than unreliable code.)</p><p>๐Ÿ’ก SeleniumBase lets you change the explicit timeout values of methods:<br />โœ…<code>self.click("button",timeout=10)</code><br />With raw Selenium, that requires more code:<br />โŒ<code>WebDriverWait(driver,10).until(EC.element_to_be_clickable("css selector", "button")).click()</code><br />(Simple code is better than complex code.)</p><p>๐Ÿ’ก SeleniumBase gives you clean error output when a test fails. With raw Selenium, error messages can get very messy.</p><p>๐Ÿ’ก SeleniumBase gives you the option to generate a dashboard and reports for tests. It also saves screenshots from failing tests to the <code>./latest_logs/</code> folder. Raw Selenium does not have these options out-of-the-box.</p><p>๐Ÿ’ก SeleniumBase includes desktop GUI apps for running tests, such as <b>SeleniumBase Commander</b> for <code>pytest</code>, and <b>SeleniumBase Behave GUI.</b></p><p>๐Ÿ’ก SeleniumBase has its own Recorder & Test Generator that can create tests from manual browser actions. SeleniumBase also has many other useful tools and console scripts for getting things done quickly. (<i>See the documentation for more details!</i>)</p> </div> </details>
<h4>Here's a 2FA/MFA app that can be tested with SeleniumBase:</h4><p align="left"><a href="https://seleniumbase.io/realworld/login" target="_blank"><img src="https://seleniumbase.io/cdn/img/mfa_login_s.png" width="290" alt="SeleniumBase MFA Demo App" title="SeleniumBase MFA Demo App" /></a></p><h4>Here are a few scripts to test that app with SeleniumBase:</h4><p align="left">๐Ÿ“˜๐Ÿ“ An example test with the <b>BaseCase</b> class. Runs with <code>pytest</code> or <code>nosetests</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">Learn more</a>)</p>
from seleniumbase import BaseCase

class TestMFALogin(BaseCase):
    def test_mfa_login(self):
        self.open("https://seleniumbase.io/realworld/login")
        self.type("#username", "demo_user")
        self.type("#password", "secret_pass")
        self.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG")  # 6-digit
        self.assert_element("img#image1")
        self.assert_exact_text("Welcome!", "h1")
        self.click('a:contains("This Page")')
        self.save_screenshot_to_logs()
<p align="left">๐Ÿ“—๐Ÿ“ An example test with the <b>sb</b> <code>pytest</code> fixture. Runs with <code>pytest</code>.</p>
def test_mfa_login(sb):
    sb.open("https://seleniumbase.io/realworld/login")
    sb.type("#username", "demo_user")
    sb.type("#password", "secret_pass")
    sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG")  # 6-digit
    sb.assert_element("img#image1")
    sb.assert_exact_text("Welcome!", "h1")
    sb.click('a:contains("This Page")')
    sb.save_screenshot_to_logs()
<p align="left">๐Ÿ“•๐Ÿ“ An example test with <b>behave-BDD</b> <a href="https://behave.readthedocs.io/en/stable/gherkin.html" target="_blank">Gherkin</a> structure. Runs with <code>behave</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md">Learn more</a>)</p>
Feature: SeleniumBase scenarios for the RealWorld App

  Scenario: Verify RealWorld App
    Given Open "seleniumbase.io/realworld/login"
    When Type "demo_user" into "#username"
    And Type "secret_pass" into "#password"
    And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode"
    Then Assert element "img#image1"
    And Assert exact text "Welcome!" in "h1"
    And Click 'a:contains("This Page")'
    And Save screenshot to logs

<a id="python_installation"></a>

<h2><img src="https://seleniumbase.io/cdn/img/python_logo.png" title="SeleniumBase" width="42" /> Python Setup:</h2>

๐Ÿ”ต Add Python and Git to your System PATH.

๐Ÿ”ต Using a Python virtual env is recommended.

<a id="install_seleniumbase"></a>

<h2><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Install SeleniumBase:</h2>

You can install seleniumbase from GitHub or PyPI:

๐Ÿ”ต Installing seleniumbase from a GitHub clone:

git clone https://github.com/seleniumbase/SeleniumBase.git
cd SeleniumBase/
pip install .  # Normal installation
pip install -e .  # Editable install

(When using a virtual env, the Editable install is faster.)

To upgrade an existing install from a GitHub clone:

git pull  # To pull the latest version
pip install -e .  # Or "pip install ."

๐Ÿ”ต Installing seleniumbase from PyPI:

pip install seleniumbase

(Add --upgrade OR -U to install the latest seleniumbase.) (Add --force-reinstall to also install the latest dependencies.) (Use pip3 if multiple versions of Python are installed.)

To upgrade an existing install from PyPI:

pip install -U seleniumbase

๐Ÿ”ต Type seleniumbase or sbase to verify that SeleniumBase was installed successfully:

   ______     __           _                  ____                
  / ____/__  / /__  ____  (_)_  ______ ___   / _  \____  ________ 
  \__ \/ _ \/ / _ \/ __ \/ / / / / __ `__ \ / /_) / __ \/ ___/ _ \
 ___/ /  __/ /  __/ / / / / /_/ / / / / / // /_) / (_/ /__  /  __/
/____/\___/_/\___/_/ /_/_/\__,_/_/ /_/ /_//_____/\__,_/____/\___/ 
------------------------------------------------------------------

 * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"
 *    OR:        "sbase [COMMAND] [PARAMETERS]"

COMMANDS:
      get / install    [DRIVER] [OPTIONS]
      methods          (List common Python methods)
      options          (List common pytest options)
      behave-options   (List common behave options)
      gui / commander  [OPTIONAL PATH or TEST FILE]
      behave-gui       (SBase Commander for Behave)
      mkdir            [DIRECTORY] [OPTIONS]
      mkfile           [FILE.py] [OPTIONS]
      mkrec / codegen  [FILE.py] [OPTIONS]
      recorder         (Open Recorder Desktop App.)
      record           (If args: mkrec. Else: App.)
      mkpres           [FILE.py] [LANG]
      mkchart          [FILE.py] [LANG]
      print            [FILE] [OPTIONS]
      translate        [SB_FILE.py] [LANG] [ACTION]
      convert          [WEBDRIVER_UNITTEST_FILE.py]
      extract-objects  [SB_FILE.py]
      inject-objects   [SB_FILE.py] [OPTIONS]
      objectify        [SB_FILE.py] [OPTIONS]
      revert-objects   [SB_FILE.py] [OPTIONS]
      encrypt / obfuscate
      decrypt / unobfuscate
      download server  (Get Selenium Grid JAR file)
      grid-hub         [start|stop] [OPTIONS]
      grid-node        [start|stop] --hub=[HOST/IP]
 * (EXAMPLE: "sbase get chromedriver latest") *

    Type "sbase help [COMMAND]" for specific command info.
    For info on all commands, type: "seleniumbase --help".
    Use "pytest" for running tests.
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Downloading web drivers:</h3>

โœ… SeleniumBase automatically downloads web drivers as needed, such as chromedriver and geckodriver (Firefox).

โœ… To manually download a webdriver, see Console Scripts OR Webdriver Installation.

<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Running tests:</h3>

๐Ÿ”ต If you've cloned SeleniumBase, you can run tests from the examples/ folder.

<p align="left">Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py">my_first_test.py</a>:</p>
cd examples/
pytest my_first_test.py

(Chrome is the default browser if not specified with --browser. On Linux, --headless is the default behavior.)

<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.io/cdn/gif/swag_labs_4.gif" alt="SeleniumBase Test" title="SeleniumBase Test" width="400" /></a>

<p align="left"><b>Here's the code for <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py">my_first_test.py</a>:</b></p>
from seleniumbase import BaseCase

class MyTestClass(BaseCase):
    def test_swag_labs(self):
        self.open("https://www.saucedemo.com")
        self.type("#user-name", "standard_user")
        self.type("#password", "secret_sauce\n")
        self.assert_element("#inventory_container")
        self.assert_text("PRODUCTS", "span.title")
        self.click('button[name*="backpack"]')
        self.click("#shopping_cart_container a")
        self.assert_text("YOUR CART", "span.title")
        self.assert_text("Backpack", "div.cart_item")
        self.click("button#checkout")
        self.type("#first-name", "SeleniumBase")
        self.type("#last-name", "Automation")
        self.type("#postal-code", "77123")
        self.click("input#continue")
        self.assert_text("CHECKOUT: OVERVIEW")
        self.assert_text("Backpack", "div.cart_item")
        self.click("button#finish")
        self.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
        self.assert_element('img[alt="Pony Express"]')
        self.js_click("a#logout_sidebar_link")
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Here are some common SeleniumBase methods that you might find in tests:</h3>
self.open(url)  # Navigate the browser window to the URL.
self.type(selector, text)  # Update the field with the text.
self.click(selector)  # Click the element with the selector.
self.click_link(link_text)  # Click the link containing text.
self.go_back()  # Navigate back to the previous URL.
self.select_option_by_text(dropdown_selector, option)
self.hover_and_click(hover_selector, click_selector)
self.drag_and_drop(drag_selector, drop_selector)
self.get_text(selector)  # Get the text from the element.
self.get_current_url()  # Get the URL of the current page.
self.get_page_source()  # Get the HTML of the current page.
self.get_attribute(selector, attribute)  # Get element attribute.
self.get_title()  # Get the title of the current page.
self.switch_to_frame(frame)  # Switch into the iframe container.
self.switch_to_default_content()  # Leave the iframe container.
self.open_new_window()  # Open a new window in the same browser.
self.switch_to_window(window)  # Switch to the browser window.
self.switch_to_default_window()  # Switch to the original window.
self.get_new_driver(OPTIONS)  # Open a new driver with OPTIONS.
self.switch_to_driver(driver)  # Switch to the browser driver.
self.switch_to_default_driver()  # Switch to the original driver.
self.wait_for_element(selector)  # Wait until element is visible.
self.is_element_visible(selector)  # Return element visibility.
self.is_text_visible(text, selector)  # Return text visibility.
self.sleep(seconds)  # Do nothing for the given amount of time.
self.save_screenshot(name)  # Save a screenshot in .png format.
self.assert_element(selector)  # Verify the element is visible.
self.assert_text(text, selector)  # Verify text in the element.
self.assert_title(title)  # Verify the title of the web page.
self.assert_downloaded_file(file)  # Verify file was downloaded.
self.assert_no_404_errors()  # Verify there are no broken links.
self.assert_no_js_errors()  # Verify there are no JS errors.

๐Ÿ”ต For the complete list of SeleniumBase methods, see: <b><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">Method Summary</a></b>

<h2><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Learn More:</h2>

โœ… Supports all major web browsers and operating systems:

<p><b>Browsers:</b> Chrome, Edge, Firefox, IE, and Safari.</p> <p><b>Systems: </b>Linux, macOS, Windows, and Ubuntu.</p>

โœ… Works on popular CI/CD platforms:

<p><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md"><img alt="GitHub Actions integration" src="https://img.shields.io/badge/GitHub_Actions-12B2C2.svg?logo=GitHubActions&logoColor=CFFFC2" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md"><img alt="Jenkins integration" src="https://img.shields.io/badge/Jenkins-32B242.svg?logo=jenkins&logoColor=white" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/azure_pipelines/ReadMe.md"><img alt="Azure integration" src="https://img.shields.io/badge/Azure-2288EE.svg?logo=AzurePipelines&logoColor=white" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md"><img alt="Google Cloud integration" src="https://img.shields.io/badge/Google_Cloud-11CAE8.svg?logo=GoogleCloud&logoColor=EE0066" /></a> <a href="#utilizing_advanced_features"><img alt="AWS integration" src="https://img.shields.io/badge/AWS-4488DD.svg?logo=AmazonAWS&logoColor=FFFF44" /></a> <a href="https://en.wikipedia.org/wiki/Personal_computer" target="_blank"><img alt="Your Computer" src="https://img.shields.io/badge/๐Ÿ’ป_Your_Computer-44E6E6.svg" /></a></p>

โœ… Automatic WebDriver Abilities:

<p>SeleniumBase automatically handles common WebDriver actions such as spinning up web browsers and saving screenshots during test failures. (<i><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">Read more about customizing test runs</a>.</i>)</p>

โœ… Simplified Code:

<p>SeleniumBase uses simple syntax for commands. Example:</p>
self.type("input", "dogs\n")

SeleniumBase tests can be run with both pytest and nosetests, but using pytest is recommended. (chrome is the default browser if not specified.)

pytest my_first_test.py --chrome

nosetests test_suite.py --firefox

โœ… Automatic Test Discovery:

<p>All Python methods that start with <code>test_</code> will be run automatically when running <code>pytest</code> or <code>nosetests</code> on Python files. You can also be more specific on what to run within a file by using the following: (<i>Note that the syntax is different for pytest vs nosetests.</i>)</p>
pytest [FILE_NAME.py]::[CLASS_NAME]::[METHOD_NAME]

nosetests [FILE_NAME.py]:[CLASS_NAME].[METHOD_NAME]

โœ… No More Flaky Tests:

<p>SeleniumBase methods automatically wait for page elements to finish loading before interacting with them (<i>up to a timeout limit</i>). This means you <b>no longer need</b> random <span><b>time.sleep()</b></span> statements in your scripts.</p> <img src="https://img.shields.io/badge/Flaky Tests%3F-%20NO%21-11BBDD.svg" alt="NO MORE FLAKY TESTS!" />

โœ… Automated/Manual Hybrid Mode:

<p>SeleniumBase includes a solution called <b><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">MasterQA</a></b>, which speeds up manual testing by having automation perform all the browser actions while the manual tester handles validation.</p>

โœ… Feature-Rich:

<p>For a full list of SeleniumBase features, <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md">Click Here</a>.</p>

<a id="detailed_instructions"></a>

<h2><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Detailed Instructions:</h2>

<a id="seleniumbase_demo_mode"></a> ๐Ÿ”ต You can use Demo Mode to help you see what a test is doing: If a test is moving too fast for your eyes, run it in Demo Mode by adding --demo on the command-line, which pauses the browser briefly between actions, highlights page elements being acted on, and displays assertions:

pytest my_first_test.py --demo

๐Ÿ”ต Pytest includes test discovery. If you don't specify a specific file or folder to run from, pytest will search all subdirectories automatically for tests to run based on the following matching criteria: Python filenames that start with test_ or end with _test.py. Python methods that start with test_. The Python class name can be anything since SeleniumBase's BaseCase class inherits from the unittest.TestCase class. You can see which tests are getting discovered by pytest by using:

pytest --collect-only -q

๐Ÿ”ต You can use the following calls in your scripts to help you debug issues:

import time; time.sleep(5)  # Makes the test wait and do nothing for 5 seconds.
import ipdb; ipdb.set_trace()  # Enter debugging mode. n = next, c = continue, s = step.
import pytest; pytest.set_trace()  # Enter debugging mode. n = next, c = continue, s = step.

๐Ÿ”ต To pause an active test that throws an exception or error, add --pdb:

pytest my_first_test.py --pdb

The code above will leave your browser window open in case there's a failure. (ipdb commands: 'n', 'c', 's' => next, continue, step).

๐Ÿ”ต Here are some useful command-line options that come with pytest:

-v  # Verbose mode. Prints the full name of each test run.
-q  # Quiet mode. Print fewer details in the console output when running tests.
-x  # Stop running the tests after the first failure is reached.
--html=report.html  # Creates a detailed pytest-html report after tests finish.
--collect-only | --co  # Show what tests would get run. (Without running them)
-n=NUM  # Multithread the tests using that many threads. (Speed up test runs!)
-s  # See print statements. (Should be on by default with pytest.ini present.)
--junit-xml=report.xml  # Creates a junit-xml report after tests finish.
--pdb  # If a test fails, enter Post Mortem Debug Mode. (Don't use with CI!)
--trace  # Enter Debug Mode at the beginning of each test. (Don't use with CI!)
-m=MARKER  # Run tests with the specified pytest marker.

๐Ÿ”ต SeleniumBase provides additional pytest command-line options for tests:

--browser=BROWSER  # (The web browser to use. Default: "chrome".)
--chrome  # (Shortcut for "--browser=chrome". On by default.)
--edge  # (Shortcut for "--browser=edge".)
--firefox  # (Shortcut for "--browser=firefox".)
--ie  # (Shortcut for "--browser=ie".)
--opera  # (Shortcut for "--browser=opera".)
--safari  # (Shortcut for "--browser=safari".)
--cap-file=FILE  # (The web browser's desired capabilities to use.)
--cap-string=STRING  # (The web browser's desired capabilities to use.)
--settings-file=FILE  # (Override default SeleniumBase settings.)
--env=ENV  # (Set the test env. Access with "self.env" in tests.)
--account=STR  # (Set account. Access with "self.account" in tests.)
--data=STRING  # (Extra test data. Access with "self.data" in tests.)
--var1=STRING  # (Extra test data. Access with "self.var1" in tests.)
--var2=STRING  # (Extra test data. Access with "self.var2" in tests.)
--var3=STRING  # (Extra test data. Access with "self.var3" in tests.)
--variables=DICT  # (Extra test data. Access with "self.variables".)
--user-data-dir=DIR  # (Set the Chrome user data directory to use.)
--protocol=PROTOCOL  # (The Selenium Grid protocol: http|https.)
--server=SERVER  # (The Selenium Grid server/IP used for tests.)
--port=PORT  # (The Selenium Grid port used by the test server.)
--proxy=SERVER:PORT  # (Connect to a proxy server:port for tests.)
--proxy=USERNAME:PASSWORD@SERVER:PORT  # (Use authenticated proxy server.)
--proxy-bypass-list=STRING  # (";"-separated hosts to bypass, Eg "*.foo.com")
--proxy-pac-url=URL  # (Connect to a proxy server using a PAC_URL.pac file.)
--proxy-pac-url=USERNAME:PASSWORD@URL  # (Authenticated proxy with PAC URL.)
--agent=STRING  # (Modify the web browser's User-Agent string.)
--mobile  # (Use the mobile device emulator while running tests.)
--metrics=STRING  # (Set mobile metrics: "CSSWidth,CSSHeight,PixelRatio".)
--chromium-arg="ARG=N,ARG2"  # (Set Chromium args, ","-separated, no spaces.)
--firefox-arg="ARG=N,ARG2"  # (Set Firefox args, comma-separated, no spaces.)
--firefox-pref=SET  # (Set a Firefox preference:value set, comma-separated.)
--extension-zip=ZIP  # (Load a Chrome Extension .zip|.crx, comma-separated.)
--extension-dir=DIR  # (Load a Chrome Extension directory, comma-separated.)
--headless  # (Run tests in headless mode. The default arg on Linux OS.)
--headed  # (Run tests in headed/GUI mode on Linux OS.)
--xvfb  # (Run tests using the Xvfb virtual display server on Linux OS.)
--locale=LOCALE_CODE  # (Set the Language Locale Code for the web browser.)
--interval=SECONDS  # (The autoplay interval for presentations & tour steps)
--start-page=URL  # (The starting URL for the web browser when tests begin.)
--archive-logs  #  (Archive existing log files instead of deleting them.)
--archive-downloads  #  (Archive old downloads instead of deleting them.)
--time-limit=SECONDS  # (Safely fail any test that exceeds the time limit.)
--slow  # (Slow down the automation. Faster than using Demo Mode.)
--demo  # (Slow down and visually see test actions as they occur.)
--demo-sleep=SECONDS  # (Set the wait time after Slow & Demo Mode actions.)
--highlights=NUM  # (Number of highlight animations for Demo Mode actions.)
--message-duration=SECONDS  # (The time length for Messenger alerts.)
--check-js  # (Check for JavaScript errors after page loads.)
--ad-block  # (Block some types of display ads from loading.)
--block-images  # (Block images from loading during tests.)
--do-not-track  # (Indicate to websites that you don't want to be tracked.)
--verify-delay=SECONDS  # (The delay before MasterQA verification checks.)
--recorder  # (Enables the Recorder for turning browser actions into code.)
--rec-behave  # (Same as Recorder Mode, but also generates behave-gherkin.)
--rec-sleep  # (If the Recorder is enabled, also records self.sleep calls.)
--rec-print  # (If the Recorder is enabled, prints output after tests end.)
--disable-csp  # (Disable the Content Security Policy of websites.)
--disable-ws  # (Disable Web Security on Chromium-based browsers.)
--enable-ws  # (Enable Web Security on Chromium-based browsers.)
--enable-sync  # (Enable "Chrome Sync".)
--use-auto-ext  # (Use Chrome's automation extension.)
--remote-debug  # (Enable Chrome's Remote Debugger on http://localhost:9222)
--final-debug  # (Enter Debug Mode after each test ends. Don't use with CI!)
--dashboard  # (Enable the SeleniumBase Dashboard. Saved at: dashboard.html)
--dash-title=STRING  # (Set the title shown for the generated dashboard.)
--swiftshader  # (Use Chrome's "--use-gl=swiftshader" feature.)
--incognito  #  (Enable Chrome's Incognito mode.)
--guest  # (Enable Chrome's Guest mode.)
--devtools  # (Open Chrome's DevTools when the browser opens.)
--reuse-session | --rs  # (Reuse the browser session between tests.)
--crumbs  # (Delete all cookies between tests reusing a session.)
--window-size=WIDTH,HEIGHT  # (Set the browser's starting window size.)
--maximize  # (Start tests with the browser window maximized.)
--screenshot  # (Save a screenshot at the end of each test.)
--visual-baseline  # (Set the visual baseline for Visual/Layout tests.)
--external-pdf  # (Set Chrome "plugins.always_open_pdf_externally": True.)
--timeout-multiplier=MULTIPLIER  # (Multiplies the default timeout values.)
--list-fail-page  # (After each failing test, list the URL of the failure.)

(For more details, see the full list of command-line options here.)

๐Ÿ”ต During test failures, logs and screenshots from the most recent test run will get saved to the latest_logs/ folder. Those logs will get moved to archived_logs/ if you add --archive_logs to command-line options, or have ARCHIVE_EXISTING_LOGS set to True in settings.py, otherwise log files with be cleaned up at the start of the next test run. The test_suite.py collection contains tests that fail on purpose so that you can see how logging works.

cd examples/

pytest test_suite.py --browser=chrome

pytest test_suite.py --browser=firefox

An easy way to override seleniumbase/config/settings.py is by using a custom settings file. Here's the command-line option to add to tests: (See examples/custom_settings.py) --settings_file=custom_settings.py (Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)

๐Ÿ”ต To pass additional data from the command-line to tests, add --data="ANY STRING". Inside your tests, you can use self.data to access that.

<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Test Directory Configuration:</h3>

๐Ÿ”ต When running tests with pytest, you'll want a copy of pytest.ini in your root folders. When running tests with nosetests, you'll want a copy of setup.cfg in your root folders. These files specify default configuration details for tests. Folders should also include a blank __init__.py file, which allows your tests to import files from that folder.

๐Ÿ”ต sbase mkdir DIR creates a folder with config files and sample tests:

sbase mkdir ui_tests

That new folder will have these files:

ui_tests/
โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ my_first_test.py
โ”œโ”€โ”€ parameterized_test.py
โ”œโ”€โ”€ pytest.ini
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ setup.cfg
โ”œโ”€โ”€ test_demo_site.py
โ””โ”€โ”€ boilerplates/
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ base_test_case.py
    โ”œโ”€โ”€ boilerplate_test.py
    โ”œโ”€โ”€ classic_obj_test.py
    โ”œโ”€โ”€ page_objects.py
    โ”œโ”€โ”€ sb_fixture_test.py
    โ””โ”€โ”€ samples/
        โ”œโ”€โ”€ __init__.py
        โ”œโ”€โ”€ google_objects.py
        โ”œโ”€โ”€ google_test.py
        โ”œโ”€โ”€ sb_swag_test.py
        โ””โ”€โ”€ swag_labs_test.py

<b>ProTipโ„ข:</b> You can also create a boilerplate folder without any sample tests in it by adding -b or --basic to the sbase mkdir command:

sbase mkdir ui_tests --basic

That new folder will have these files:

ui_tests/
โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ pytest.ini
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ setup.cfg

Of those files, the pytest.ini config file is the most important, followed by a blank __init__.py file. There's also a setup.cfg file (only needed for nosetests). Finally, the requirements.txt file can be used to help you install seleniumbase into your environments (if it's not already installed).


<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Log files from failed tests:</h3>

Let's try an example of a test that fails:

""" test_fail.py """
from seleniumbase import BaseCase

class MyTestClass(BaseCase):

    def test_find_army_of_robots_on_xkcd_desert_island(self):
        self.open("https://xkcd.com/731/")
        self.assert_element("div#ARMY_OF_ROBOTS", timeout=1)  # This should fail

You can run it from the examples/ folder like this:

pytest test_fail.py

๐Ÿ”ต You'll notice that a logs folder, "latest_logs", was created to hold information about the failing test, and screenshots. During test runs, past results get moved to the archived_logs folder if you have ARCHIVE_EXISTING_LOGS set to True in settings.py, or if your run tests with --archive-logs. If you choose not to archive existing logs, they will be deleted and replaced by the logs of the latest test run.


<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>

๐Ÿ”ต The --dashboard option for pytest generates a SeleniumBase Dashboard located at dashboard.html, which updates automatically as tests run and produce results. Example:

pytest --dashboard --rs --headless
<img src="https://seleniumbase.io/cdn/img/dashboard_1.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="380" />

๐Ÿ”ต Additionally, you can host your own SeleniumBase Dashboard Server on a port of your choice. Here's an example of that using Python 3's http.server:

python -m http.server 1948

๐Ÿ”ต Now you can navigate to http://localhost:1948/dashboard.html in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use CTRL+C to stop the http server.)

๐Ÿ”ต Here's a full example of what the SeleniumBase Dashboard may look like:

pytest test_suite.py --dashboard --rs --headless
<img src="https://seleniumbase.io/cdn/img/dashboard_2.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="480" />

<a id="creating_visual_reports"></a>

<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Creating Visual Test Reports:</h3><h4><b>Pytest Reports:</b></h4>

๐Ÿ”ต Using --html=report.html gives you a fancy report of the name specified after your test suite completes.

pytest test_suite.py --html=report.html
<img src="https://seleniumbase.io/cdn/img/html_report.png" alt="Example Pytest Report" title="Example Pytest Report" width="520" />

๐Ÿ”ต When combining pytest html reports with SeleniumBase Dashboard usage, the pie chart from the Dashboard will get added to the html report. Additionally, if you set the html report URL to be the same as the Dashboard URL when also using the dashboard, (example: --dashboard --html=dashboard.html), then the Dashboard will become an advanced html report when all the tests complete.

๐Ÿ”ต Here's an example of an upgraded html report:

pytest test_suite.py --dashboard --html=report.html
<img src="https://seleniumbase.io/cdn/img/dash_report.jpg" alt="Dashboard Pytest HTML Report" title="Dashboard Pytest HTML Report" width="520" />

If viewing pytest html reports in Jenkins, you may need to configure Jenkins settings for the html to render correctly. This is due to Jenkins CSP changes.

You can also use --junit-xml=report.xml to get an xml report instead. Jenkins can use this file to display better reporting for your tests.

pytest test_suite.py --junit-xml=report.xml
<h4><b>Nosetest Reports:</b></h4>

The --report option gives you a fancy report after your test suite completes.

nosetests test_suite.py --report
<img src="https://seleniumbase.io/cdn/img/nose_report.png" alt="Example Nosetest Report" title="Example Nosetest Report" width="320" />

(NOTE: You can add --show-report to immediately display Nosetest reports after the test suite completes. Only use --show-report when running tests locally because it pauses the test run.)

<h4><b>Behave Dashboard & Reports:</b></h4>

(The behave_bdd/ folder can be found in the examples/ folder.)

behave behave_bdd/features/ -D dashboard -D headless
<img src="https://seleniumbase.io/cdn/img/sb_behave_dashboard.png" title="SeleniumBase" width="500">

You can also use --junit to get .xml reports for each Behave feature. Jenkins can use these files to display better reporting for your tests.

behave behave_bdd/features/ --junit -D rs -D headless
<h4><b>Allure Reports:</b></h4>

See: https://docs.qameta.io/allure/

SeleniumBase no longer includes allure-pytest as part of installed dependencies. If you want to use it, install it first:

pip install allure-pytest

Now your tests can create Allure results files, which can be processed by Allure Reports.

pytest test_suite.py --alluredir=allure_results
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Using a Proxy Server:</h3>

If you wish to use a proxy server for your browser tests (Chromium or Firefox), you can add --proxy=IP_ADDRESS:PORT as an argument on the command line.

pytest proxy_test.py --proxy=IP_ADDRESS:PORT

If the proxy server that you wish to use requires authentication, you can do the following (Chromium only):

pytest proxy_test.py --proxy=USERNAME:PASSWORD@IP_ADDRESS:PORT

SeleniumBase also supports SOCKS4 and SOCKS5 proxies:

pytest proxy_test.py --proxy="socks4://IP_ADDRESS:PORT"

pytest proxy_test.py --proxy="socks5://IP_ADDRESS:PORT"

To make things easier, you can add your frequently-used proxies to PROXY_LIST in proxy_list.py, and then use --proxy=KEY_FROM_PROXY_LIST to use the IP_ADDRESS:PORT of that key.

pytest proxy_test.py --proxy=proxy1
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Changing the User-Agent:</h3>

๐Ÿ”ต If you wish to change the User-Agent for your browser tests (Chromium and Firefox only), you can add --agent="USER AGENT STRING" as an argument on the command-line.

pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU"
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Handling Pop-Up / Pop Up Alerts:</h3>

๐Ÿ”ต <code>self.accept_alert()</code> automatically waits for and accepts alert pop-ups. <code>self.dismiss_alert()</code> automatically waits for and dismisses alert pop-ups. On occasion, some methods like <code>self.click(SELECTOR)</code> might dismiss a pop-up on its own because they call JavaScript to make sure that the <code>readyState</code> of the page is <code>complete</code> before advancing. If you're trying to accept a pop-up that got dismissed this way, use this workaround: Call <code>self.find_element(SELECTOR).click()</code> instead, (which will let the pop-up remain on the screen), and then use <code>self.accept_alert()</code> to accept the pop-up (<a href="https://github.com/seleniumbase/SeleniumBase/issues/600#issuecomment-647270426">more on that here</a>). If pop-ups are intermittent, wrap code in a try/except block.

<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Building Guided Tours for Websites:</h3>

๐Ÿ”ต Learn about <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md">SeleniumBase Interactive Walkthroughs</a> (in the examples/tour_examples/ folder). It's great for prototyping a website onboarding experience.

<a id="utilizing_advanced_features"></a>


<div></div> <h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Production Environments & Integrations:</h3><div></div> <details> <summary> โ–ถ๏ธ Here are some things you can do to set up a production environment for your testing. (<b><u>click to expand</u></b>)</summary><ul> <li>You can set up a <a href="https://jenkins.io/" target="_blank">Jenkins</a> build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.</li><li>You can use <a href="https://selenium.dev/documentation/en/grid/" target="_blank">the Selenium Grid</a> to scale your testing by distributing tests on several machines with parallel execution. To do this, check out the <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid">SeleniumBase selenium_grid folder</a>, which should have everything you need, including the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">Selenium Grid ReadMe</a>, which will help you get started.</li><li>If you're using the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mysql_installation.md">SeleniumBase MySQL feature</a> to save results from tests running on a server machine, you can install <a href="https://dev.mysql.com/downloads/tools/workbench/">MySQL Workbench</a> to help you read & write from your DB more easily.</li><li>If you're using AWS, you can set up an <a href="https://aws.amazon.com/s3/" target="_blank">Amazon S3</a> account for saving log files and screenshots from your tests. To activate this feature, modify <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py">settings.py</a> with connection details in the S3 section, and add <code>--with-s3-logging</code> on the command-line when running your tests.</li> </ul>

Here's an example of running tests with some additional features enabled:

pytest [YOUR_TEST_FILE.py] --with-db-reporting --with-s3-logging
</details>

<a id="detailed_method_specifications"></a>

<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Detailed Method Specifications and Examples:</h3>

๐Ÿ”ต Navigating to a web page: (and related commands)

self.open("https://xkcd.com/378/")  # This method opens the specified page.

self.go_back()  # This method navigates the browser to the previous page.

self.go_forward()  # This method navigates the browser forward in history.

self.refresh_page()  # This method reloads the current page.

self.get_current_url()  # This method returns the current page URL.

self.get_page_source()  # This method returns the current page source.

<b>ProTipโ„ข:</b> You can use the <code>self.get_page_source()</code> method with Python's <code>find()</code> command to parse through HTML to find something specific. (For more advanced parsing, see the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_parse_soup.py">BeautifulSoup example</a>.)

source = self.get_page_source()
head_open_tag = source.find('<head>')
head_close_tag = source.find('</head>', head_open_tag)
everything_inside_head = source[head_open_tag+len('<head>'):head_close_tag]

๐Ÿ”ต Clicking:

To click an element on the page:

self.click("div#my_id")

ProTipโ„ข: In most web browsers, you can right-click on a page and select Inspect Element to see the CSS selector details that you'll need to create your own scripts.

๐Ÿ”ต Typing Text:

<code>self.type(selector, text)</code> # updates the text from the specified element with the specified value. An exception is raised if the element is missing or if the text field is not editable. Example:

self.type("input#id_value", "2012")

You can also use <code>self.add_text()</code> or the WebDriver <code>.send_keys()</code> command, but those won't clear the text box first if there's already text inside. If you want to type in special keys, that's easy too. Here's an example:

from selenium.webdriver.common.keys import Keys
self.find_element("textarea").send_keys(Keys.SPACE + Keys.BACK_SPACE + '\n')  # The backspace should cancel out the space, leaving you with the newline

๐Ÿ”ต Getting the text from an element on a page:

text = self.get_text("header h2")

๐Ÿ”ต Getting the attribute value from an element on a page:

attribute = self.get_attribute("#comic img", "title")

๐Ÿ”ต Asserting existence of an element on a page within some number of seconds:

self.wait_for_element_present("div.my_class", timeout=10)

(NOTE: You can also use: self.assert_element_present(ELEMENT))

๐Ÿ”ต Asserting visibility of an element on a page within some number of seconds:

self.wait_for_element_visible("a.my_class", timeout=5)

(NOTE: The short versions of this are self.find_element(ELEMENT) and self.assert_element(ELEMENT). The find_element() version returns the element)

Since the line above returns the element, you can combine that with .click() as shown below:

self.find_element("a.my_class", timeout=5).click()

# But you're better off using the following statement, which does the same thing:

self.click("a.my_class")  # DO IT THIS WAY!

ProTipโ„ข: You can use dots to signify class names (Ex: div.class_name) as a simplified version of div[class="class_name"] within a CSS selector.

You can also use *= to search for any partial value in a CSS selector as shown below:

self.click('a[name*="partial_name"]')

๐Ÿ”ต Asserting visibility of text inside an element on a page within some number of seconds:

self.assert_text("Make it so!", "div#trek div.picard div.quotes")
self.assert_text("Tea. Earl Grey. Hot.", "div#trek div.picard div.quotes", timeout=3)

(NOTE: self.find_text(TEXT, ELEMENT) and self.wait_for_text(TEXT, ELEMENT) also do this. For backwards compatibility, older method names were kept, but the default timeout may be different.)

๐Ÿ”ต Asserting Anything:

self.assert_true(myvar1 == something)

self.assert_equal(var1, var2)

๐Ÿ”ต Useful Conditional Statements: (with creative examples in action)

is_element_visible(selector) # is an element visible on a page

if self.is_element_visible('div#warning'):
    print("Red Alert: Something bad might be happening!")

is_element_present(selector) # is an element present on a page

if self.is_element_present('div#top_secret img.tracking_cookie'):
    self.contact_cookie_monster()  # Not a real SeleniumBase method
else:
    current_url = self.get_current_url()
    self.contact_the_nsa(url=current_url, message="Dark Zone Found")  # Not a real SeleniumBase method

Another example:

def is_there_a_cloaked_klingon_ship_on_this_page():
    if self.is_element_present("div.ships div.klingon"):
        return not self.is_element_visible("div.ships div.klingon")
    return False
<div></div> <details> <summary> โ–ถ๏ธ is_text_visible(text, selector) # is text visible on a page (<b><u>click to expand</u></b>)</summary>
def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
    selector = "div.superbowl_%s div.commercials div.transcript div.picard" % superbowl_year
    if self.is_text_visible("Yes, it was I who summoned you all here.", selector):
        return "Picard Paramount+ Superbowl Ad 2020"
    elif self.is_text_visible("Commander, signal the following: Our Network is Secure!"):
        return "Picard Mirror Universe iboss Superbowl Ad 2018"
    elif self.is_text_visible("For the Love of Marketing and Earl Grey Tea!", selector):
        return "Picard Mirror Universe HubSpot Superbowl Ad 2015"
    elif self.is_text_visible("Delivery Drones... Engage", selector):
        return "Picard Mirror Universe Amazon Superbowl Ad 2015"
    elif self.is_text_visible("Bing it on Screen!", selector):
        return "Picard Mirror Universe Microsoft Superbowl Ad 2015"
    elif self.is_text_visible("OK Glass, Make it So!", selector):
        return "Picard Mirror Universe Google Superbowl Ad 2015"
    elif self.is_text_visible("Number One, I've Never Seen Anything Like It.", selector):
        return "Picard Mirror Universe Tesla Superbowl Ad 2015"
    elif self.is_text_visible("Let us make sure history never forgets the name ... Facebook", selector):
        return "Picard Mirror Universe Facebook Superbowl Ad 2015"
    elif self.is_text_visible("""With the first link, the chain is forged.
                              The first speech censored, the first thought forbidden,
                              the first freedom denied, chains us all irrevocably.""", selector):
        return "Picard Mirror Universe Wikimedia Superbowl Ad 2015"
    else:
        raise Exception("Reports of my assimilation are greatly exaggerated.")
</details>

๐Ÿ”ต Switching Tabs:

<p>If your test opens up a new tab/window, you can switch to it. (SeleniumBase automatically switches to new tabs that don't open to <code>about:blank</code> URLs.)</p>
self.switch_to_window(1)  # This switches to the new tab (0 is the first one)

๐Ÿ”ต <b>ProTipโ„ข:</b> iframes follow the same principle as new windows - you need to specify the iframe if you want to take action on something in there

self.switch_to_frame('ContentManagerTextBody_ifr')
# Now you can act inside the iframe
# .... Do something cool (here)
self.switch_to_default_content()  # Exit the iframe when you're done

๐Ÿ”ต Executing Custom jQuery Scripts:

<p>jQuery is a powerful JavaScript library that allows you to perform advanced actions in a web browser. If the web page you're on already has jQuery loaded, you can start executing jQuery scripts immediately. You'd know this because the web page would contain something like the following in the HTML:</p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

๐Ÿ”ต It's OK if you want to use jQuery on a page that doesn't have it loaded yet. To do so, run the following command first:

self.activate_jquery()
<div></div> <details> <summary> โ–ถ๏ธ Here are some examples of using jQuery in your scripts. (<b><u>click to expand</u></b>)</summary>
self.execute_script("jQuery, window.scrollTo(0, 600)")  # Scrolling the page

self.execute_script("jQuery('#annoying-widget').hide()")  # Hiding elements on a page

self.execute_script("jQuery('#hidden-widget').show(0)")  # Showing hidden elements on a page

self.execute_script("jQuery('#annoying-button a').remove()")  # Removing elements on a page

self.execute_script("jQuery('%s').mouseover()" % (mouse_over_item))  # Mouse-over elements on a page

self.execute_script("jQuery('input#the_id').val('my_text')")  # Fast text input on a page

self.execute_script("jQuery('div#dropdown a.link').click()")  # Click elements on a page

self.execute_script("return jQuery('div#amazing')[0].text")  # Returns the css "text" of the element given

self.execute_script("return jQuery('textarea')[2].value")  # Returns the css "value" of the 3rd textarea element on the page

(Most of the above commands can be done directly with built-in SeleniumBase methods.)

</details>

๐Ÿ”ต Some websites have a restrictive Content Security Policy to prevent users from loading jQuery and other external libraries onto their websites. If you need to use jQuery or another JS library on such a website, add --disable-csp on the command-line.

<div></div> <details> <summary> โ–ถ๏ธ In this example, JavaScript creates a referral button on a page, which is then clicked. (<b><u>click to expand</u></b>)</summary>
start_page = "https://xkcd.com/465/"
destination_page = "https://github.com/seleniumbase/SeleniumBase"
self.open(start_page)
referral_link = '''<a class='analytics test' href='%s'>Free-Referral Button!</a>''' % destination_page
self.execute_script('''document.body.innerHTML = \"%s\"''' % referral_link)
self.click("a.analytics")  # Clicks the generated button

(Due to popular demand, this traffic generation example has been included in SeleniumBase with the <code>self.generate_referral(start_page, end_page)</code> and the <code>self.generate_traffic(start_page, end_page, loops)</code> methods.)

</details>

๐Ÿ”ต Using deferred asserts:

<p>Let's say you want to verify multiple different elements on a web page in a single test, but you don't want the test to fail until you verified several elements at once so that you don't have to rerun the test to find more missing elements on the same page. That's where deferred asserts come in. Here's the example:</p>
from seleniumbase import BaseCase

class MyTestClass(BaseCase):

    def test_deferred_asserts(self):
        self.open('https://xkcd.com/993/')
        self.wait_for_element('#comic')
        self.deferred_assert_element('img[alt="Brand Identity"]')
        self.deferred_assert_element('img[alt="Rocket Ship"]')  # Will Fail
        self.deferred_assert_element('#comicmap')
        self.deferred_assert_text('Fake Item', '#middleContainer')  # Will Fail
        self.deferred_assert_text('Random', '#middleContainer')
        self.deferred_assert_element('a[name="Super Fake !!!"]')  # Will Fail
        self.process_deferred_asserts()

<code>deferred_assert_element()</code> and <code>deferred_assert_text()</code> will save any exceptions that would be raised. To flush out all the failed deferred asserts into a single exception, make sure to call <code>self.process_deferred_asserts()</code> at the end of your test method. If your test hits multiple pages, you can call <code>self.process_deferred_asserts()</code> before navigating to a new page so that the screenshot from your log files matches the URL where the deferred asserts were made.

๐Ÿ”ต Accessing Raw WebDriver:

<p>If you need access to any commands that come with standard WebDriver, you can call them directly like this:</p>
self.driver.delete_all_cookies()
capabilities = self.driver.capabilities
self.driver.find_elements("partial link text", "GitHub")

(In general, you'll want to use the SeleniumBase versions of methods when available.)

๐Ÿ”ต Retrying failing tests automatically:

<p>You can use <code>--reruns=NUM</code> to retry failing tests that many times. Use <code>--reruns-delay=SECONDS</code> to wait that many seconds between retries. Example:</p>
pytest --reruns=1 --reruns-delay=1
<p>Additionally, you can use the <code>@retry_on_exception()</code> decorator to specifically retry failing methods. (First import: <code>from seleniumbase import decorators</code>) To learn more about SeleniumBase decorators, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/common).</p><h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Wrap-Up</h3>

<b>Congratulations on getting started with SeleniumBase!</b>

<p> <div><b>If you see something, say something!</b></div> <div><a href="https://github.com/seleniumbase/SeleniumBase/issues?q=is%3Aissue+is%3Aclosed"><img src="https://img.shields.io/github/issues-closed-raw/seleniumbase/SeleniumBase.svg?color=22BB88" title="Closed Issues" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/pulls?q=is%3Apr+is%3Aclosed"><img src="https://img.shields.io/github/issues-pr-closed/seleniumbase/SeleniumBase.svg?logo=github&logoColor=white&color=22BB99" title="Closed Pull Requests" /></a></div> </p><p> <div><b>If you like us, give us a star!</b></div> <div><a href="https://github.com/seleniumbase/SeleniumBase/stargazers"><img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg?color=19A57B" title="Stargazers" /></a></div> </p> <p><div><a href="https://github.com/mdmintz">https://github.com/mdmintz</a></div></p><div><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/fancy_logo_14.png" title="SeleniumBase" width="200" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" title="SeleniumBase" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" title="SeleniumBase" alt="Join the chat!" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://img.shields.io/badge/tested%20with-SeleniumBase-04C38E.svg" alt="Tested with SeleniumBase" /></a></div> <div><a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a></div> <div><a href="https://pepy.tech/project/seleniumbase" target="_blank"><img src="https://pepy.tech/badge/seleniumbase" alt="SeleniumBase PyPI downloads" /></a></div><p><div> <span><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://seleniumbase.io/img/social/share_github.svg" title="SeleniumBase on GitHub" alt="SeleniumBase on GitHub" width="40" /></a></span> <span><a href="https://www.facebook.com/SeleniumBase" target="_blank"><img src="https://seleniumbase.io/img/social/share_facebook.svg" title="SeleniumBase on Facebook" alt="SeleniumBase on Facebook" width="37" /></a></span> <span><a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://seleniumbase.io/img/social/share_gitter.svg" title="SeleniumBase on Gitter" alt="SeleniumBase on Gitter" width="32" /></a></span> <span><a href="https://instagram.com/seleniumbase" target="_blank"><img src="https://seleniumbase.io/img/social/share_instagram.svg" title="SeleniumBase on Instagram" alt="SeleniumBase on Instagram" width="33" /></a></span> <span><a href="https://twitter.com/seleniumbase" target="_blank"><img src="https://seleniumbase.io/img/social/share_twitter.svg" title="SeleniumBase on Twitter" alt="SeleniumBase on Twitter" width="40" /></a></span> </div></p><p><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" alt="SeleniumBase" title="SeleniumBase" width="200" /></a></p> <p><a href="https://pypi.python.org/pypi/seleniumbase" target="_blank"><img src="https://badge.fury.io/py/seleniumbase.svg" alt="PyPI version" /></a></p> <p><a href="https://www.python.org/downloads/" target="_blank"><img src="https://img.shields.io/pypi/pyversions/seleniumbase.svg?color=22AAEE&logo=python" title="Supported Python Versions" /></a></p>