Update the docs

This commit is contained in:
Michael Mintz 2020-12-18 01:27:39 -05:00
parent b6ca4fc323
commit 7649a92072
10 changed files with 114 additions and 59 deletions

View File

@ -1,3 +1,3 @@
## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3.png" title="SeleniumBase" height="32"> CHANGELOG
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> CHANGELOG</h2>
### See: [SeleniumBase/releases](https://github.com/seleniumbase/SeleniumBase/releases)
<h3>See: [SeleniumBase/releases](https://github.com/seleniumbase/SeleniumBase/releases)</h3>

View File

@ -3,10 +3,10 @@
<meta property="og:description" content="Build fast, reliable, end-to-end tests." />
<meta property="og:keywords" content="Python, pytest, selenium, webdriver, test automation, testing, seleniumbase, test framework, RPA, reports, website tours, presentations">
<meta property="og:image" content="https://seleniumbase.io/cdn/img/sb_logo_dh.png" />
<link rel="icon" href="https://seleniumbase.io/img/logo3a.png" />
<link rel="icon" href="https://seleniumbase.io/img/logo6.png" />
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/">
<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" title="SeleniumBase" width="360" /></a></p>
<img src="https://seleniumbase.io/cdn/img/mac_sb_logo_3.png" alt="SeleniumBase" title="SeleniumBase" width="360" /></a></p>
<!-- View on GitHub -->
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/releases">
@ -16,7 +16,7 @@
<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="SeleniumBase" /></a> <a href="https://seleniumbase.io">
<img src="https://img.shields.io/badge/docs-%20seleniumbase.io-22BBAA.svg" alt="SeleniumBase.io Docs" /></a></p>
<p><b>SeleniumBase</b> is a complete framework for browser automation, end-to-end testing, reports, charts, presentations, website tours, and visual testing.
<p><b>SeleniumBase</b> is a complete browser automation solution for end-to-end testing, reports, charts, presentations, website tours, and visual testing.
Tests are run with <a href="https://docs.pytest.org/en/latest/index.html">pytest</a>. Browsers are controlled by <a href="https://www.w3.org/TR/webdriver2/#endpoints">WebDriver</a>.</p>
<p align="center">
@ -48,11 +48,11 @@ Tests are run with <a href="https://docs.pytest.org/en/latest/index.html">pytest
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🛂 MasterQA</a>
</p>
* Simplifies the process of creating UI tests for websites.
* Uses reliable, smart-waiting code to prevent flaky tests.
* Includes tools for [logging, screenshots, and test reports](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).
* Has plugins that add new [pytest command-line options](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).
* Enhances Selenium's Python API with [versatile methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md).
* Simplifies the creation of Web-UI tests.
* Smart-waiting code keeps tests reliable.
* Includes tools for [logging and reports](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).
* Has plugins that add new [pytest options](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).
* Has a vast library of [versatile methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md).
--------
@ -67,14 +67,14 @@ pytest test_swag_labs.py --demo
--------
<a id="python_installation"></a>
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Quick Start: 🚀</h2>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Quick Start: 🚀</h2>
* Add **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)** to your System PATH.
* Create a **[Python virtual environment](https://seleniumbase.io/help_docs/virtualenv_instructions/)**.
<a id="install_seleniumbase"></a>
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Install SeleniumBase:</h2>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Install SeleniumBase:</h2>
* You can install ``seleniumbase`` from [pypi](https://pypi.python.org/pypi/seleniumbase):
@ -131,7 +131,7 @@ COMMANDS:
* (Use "pytest" for running tests) *
```
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Download a webdriver:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Download a webdriver:</h3>
SeleniumBase can download webdrivers to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
@ -150,7 +150,7 @@ sbase install chromedriver latest
(See [seleniumbase.io/seleniumbase/console_scripts/ReadMe/](https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/) for more information on SeleniumBase console scripts.)
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Create and run tests:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Create and run tests:</h3>
* ``sbase mkdir DIR`` creates a folder with sample tests:
@ -261,7 +261,7 @@ self.save_screenshot(FILE_NAME) # Save a screenshot of the current page
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/logo3a.png" title="SeleniumBase" width="32" /> Learn More:</h2>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Learn More:</h2>
<h4>Automatic WebDriver abilities:</h4>
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>)
@ -317,7 +317,7 @@ For a full list of SeleniumBase features, <a href="https://github.com/seleniumba
<a id="detailed_instructions"></a>
<img src="https://seleniumbase.io/img/sb_logo_10.png" title="SeleniumBase" width="290">
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Detailed Instructions:</h2>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Detailed Instructions:</h2>
<a id="seleniumbase_demo_mode"></a> <b>Use Demo Mode to help you see what tests are asserting.</b>
@ -444,7 +444,7 @@ 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/logo3a.png" title="SeleniumBase" width="32" /> Test Directory Customization:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Test Directory Customization:</h3>
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.) These files specify default configuration details for tests. (For nosetest runs, you can also specify a .cfg file by using ``--config``. Example ``nosetests [MY_TEST.py] --config=[MY_CONFIG.cfg]``)
@ -457,7 +457,7 @@ pytest test_demo_site.py
```
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Logging / Results from Failing Tests:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Logging / Results from Failing Tests:</h3>
Let's try an example of a test that fails:
@ -480,11 +480,34 @@ 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](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/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/logo6.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.
<img src="https://seleniumbase.io/cdn/img/dashboard_1.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="360" />
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``:
```bash
python -m http.server 1948
```
Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the served dashboard from a web browser. (Be sure to run that command in the same directory where you ran your tests.)
Here's a full example of what the SeleniumBase Dashboard may look like:
```bash
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/logo3a.png" title="SeleniumBase" width="32" /> Creating Visual Test Suite Reports:</h3>
(NOTE: Several command-line args are different for Pytest vs Nosetests)
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Creating Visual Test Suite Reports:</h3>
<h4><b>Pytest Reports:</b></h4>
@ -523,7 +546,7 @@ pytest test_suite.py --alluredir=allure_results
```
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Using a Proxy Server:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Using a Proxy Server:</h3>
If you wish to use a proxy server for your browser tests (Chrome and Firefox only), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command-line.
@ -544,7 +567,7 @@ pytest proxy_test.py --proxy=proxy1
```
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Changing the User-Agent:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.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.
@ -553,13 +576,13 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1
```
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Building Guided Tours for Websites:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.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>
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Production Environments & Integrations:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Production Environments & Integrations:</h3>
Here are some things you can do to set up a production environment for your testing:
@ -580,7 +603,7 @@ pytest [YOUR_TEST_FILE.py] --with-db-reporting --with-s3-logging
```
<a id="detailed_method_specifications"></a>
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Detailed Method Specifications and Examples:</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Detailed Method Specifications and Examples:</h3>
<h4>Navigating to a web page (and related commands)</h4>
@ -868,7 +891,7 @@ pytest --reruns 5 --reruns-delay 1
Additionally, you can use the ``@retry_on_exception()`` decorator to specifically retry failing methods. (First import: ``from seleniumbase import decorators``) To learn more about SeleniumBase decorators, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/common).
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Wrap-Up</h3>
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Wrap-Up</h3>
<b>Congratulations on getting started with SeleniumBase!</b>

View File

@ -1,4 +1,4 @@
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="290" /></h3>
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="360" /></h3>
<h3> 📊 ChartMaker 📈 </h3>

View File

@ -46,7 +46,7 @@
<p align="center">
<div align="center"><b>Selenium 和 pytest 组合使用.</b></div>
</p>
<p align="center"><div align="center"><img src="https://cdn2.hubspot.net/hubfs/100006/images/swag_labs_gif.gif" alt="SeleniumBase" title="SeleniumBase" /></div></p>
<p align="center"><div align="center"><img src="https://seleniumbase.io/cdn/gif/swag_demo_2.gif" alt="SeleniumBase" title="SeleniumBase" /></div></p>
<a id="python_installation"></a>
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> 立即开始:</h2>
@ -105,7 +105,7 @@ pytest my_first_test.py
pytest my_first_test.py --demo
```
<img src="https://cdn2.hubspot.net/hubfs/100006/images/my_first_test_gif.gif" title="SeleniumBase" />
<img src="https://seleniumbase.io/cdn/gif/my_first_test_1.gif" title="SeleniumBase" />
<b>此处为相关代码 [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py):</b>

View File

@ -1,6 +1,6 @@
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="320">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> CLI Options</h2>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> CLI Options</h2>
You can customize test runs from the command-line interface thanks to [SeleniumBase's pytest plugin](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py), which adds CLI options for setting/enabling the browser type, headless mode, mobile mode, multithreading mode, demo mode, proxy config, user agent config, browser extensions, and more.
@ -155,14 +155,14 @@ Or the short form:
sbase options
```
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Customizing default settings:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Customizing default settings:</h3>
An easy way to override [seleniumbase/config/settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/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](https://github.com/seleniumbase/SeleniumBase/blob/master/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.)
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Running tests on a remote Selenium Grid:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests on a remote Selenium Grid:</h3>
SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, [TestingBot](https://testingbot.com/features)'s Selenium Grid, other Grids, and even your own Grid:
@ -200,7 +200,7 @@ pytest my_first_test.py --server=USERNAME:KEY@hub.lambdatest.com --port=80
Or you can create your own Selenium Grid for test distribution. ([See this ReadMe for details](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md))
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Example tests using Logging:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Example tests using Logging:</h3>
```bash
pytest test_suite.py --browser=chrome
@ -208,7 +208,7 @@ pytest test_suite.py --browser=chrome
(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 have ARCHIVE_EXISTING_LOGS set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py), otherwise log files with be cleaned up at the start of the next test run.)
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Demo Mode:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Demo Mode:</h3>
If any test is moving too fast for your eyes to see what's going on, you can 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 lets you know what test assertions are happening in real time:
@ -222,15 +222,15 @@ You can override the default wait time by either updating [settings.py](https://
pytest my_first_test.py --demo --demo-sleep=1.2
```
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Passing additional data to tests:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Passing additional data to tests:</h3>
If you want to pass additional data from the command line to your tests, you can use ``--data=STRING``. Now inside your tests, you can use ``self.data`` to access that.
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Running tests multithreaded:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests multithreaded:</h3>
To run Pytest multithreaded on multiple CPUs at the same time, add ``-n=NUM`` or ``-n NUM`` on the command line, where NUM is the number of CPUs you want to use.
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Retrying failing tests automatically:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Retrying failing tests automatically:</h3>
You can use ``--reruns=NUM`` to retry failing tests that many times. Use ``--reruns-delay=SECONDS`` to wait that many seconds between retries. Example:
@ -238,7 +238,7 @@ You can use ``--reruns=NUM`` to retry failing tests that many times. Use ``--rer
pytest --reruns=2 --reruns-delay=1
```
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Debugging tests:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Debugging tests:</h3>
You can use the following calls in your scripts to help you debug issues:
@ -256,7 +256,33 @@ pytest my_first_test.py --pdb -s
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Pytest Reports:
--------
<h3><img src="https://seleniumbase.io/img/logo6.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.
<img src="https://seleniumbase.io/cdn/img/dashboard_1.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="360" />
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``:
```bash
python -m http.server 1948
```
Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the served dashboard from a web browser. (Be sure to run that command in the same directory where you ran your tests.)
Here's a full example of what the SeleniumBase Dashboard may look like:
```bash
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" />
--------
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Pytest Reports:</h3>
Using ``--html=report.html`` gives you a fancy report of the name specified after your test suite completes.
@ -266,7 +292,9 @@ 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" />
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Nosetest Reports:
--------
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Nosetest Reports:</h3>
The ``--report`` option gives you a fancy report after your test suite completes.
@ -278,7 +306,9 @@ nosetests test_suite.py --report
(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.)
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Using a Proxy Server:
--------
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Using a Proxy Server:</h3>
If you wish to use a proxy server for your browser tests (Chrome and Firefox only), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command line.
@ -298,7 +328,9 @@ To make things easier, you can add your frequently-used proxies to PROXY_LIST in
pytest proxy_test.py --proxy=proxy1
```
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Changing the User-Agent:
--------
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Changing the User-Agent:</h3>
If you wish to change the User-Agent for your browser tests (Chrome and Firefox only), you can add ``--agent="USER-AGENT-STRING"`` as an argument on the command line.
@ -306,7 +338,7 @@ If you wish to change the User-Agent for your browser tests (Chrome and Firefox
pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU"
```
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Mobile Device Testing:
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Mobile Device Testing:</h3>
Use ``--mobile`` to quickly run your tests using Chrome's mobile device emulator with default values for device metrics (CSS Width, CSS Height, Pixel-Ratio) and a default value set for the user agent. To configure the mobile device metrics, use ``--metrics="CSS_Width,CSS_Height,Pixel_Ratio"`` to set those values. You'll also be able to set the user agent with ``--agent="USER-AGENT-STRING"`` (a default user agent will be used if not specified). To find real values for device metrics, [see this GitHub Gist](https://gist.github.com/sidferreira/3f5fad525e99b395d8bd882ee0fd9d00). For a list of available user agent strings, [check out this page](https://developers.whatismybrowser.com/useragents/explore/).

View File

@ -1,7 +1,7 @@
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb4.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
<a id="how_seleniumbase_works"></a>
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> How it works:</h2>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> How it works:</h2>
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, 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.

View File

@ -1,6 +1,6 @@
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb4.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Installation
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Installation</h2>
If installing SeleniumBase directly [from PyPI (the Python Package Index)](https://pypi.python.org/pypi/seleniumbase), use:
```bash

View File

@ -1,6 +1,6 @@
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" align="center" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://seleniumbase.io/cdn/img/sb_text_f.png" title="SeleniumBase" align="center" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Method Summary (API Reference)
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Method Summary (API Reference)</h2>
Here's a summary of SeleniumBase method definitions, which are defined in [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)
@ -401,7 +401,7 @@ self.add_series_to_chart(data_name=None, chart_name=None)
self.add_data_point(label, value, color=None, chart_name=None)
self.save_chart(chart_name=None, filename=None)
self.save_chart(chart_name=None, filename=None, folder=None)
self.display_chart(chart_name=None, filename=None, interval=0)

View File

@ -1,6 +1,6 @@
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb4.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" title="SeleniumBase" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Installing webdrivers
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Installing webdrivers</h2>
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:

View File

@ -1,8 +1,8 @@
# Project information
site_name: Docs - seleniumbase.io
site_name: SeleniumBase - Docs
site_url: https://seleniumbase.io
site_author: Michael Mintz
site_description: The world's most powerful all-in-one web automation platform. Build fast, reliable, end-to-end tests with Python.
site_description: The most advanced web automation platform for fast, reliable, end-to-end testing with Python.
# Repository information
repo_name: seleniumbase/SeleniumBase
repo_url: https://github.com/seleniumbase/SeleniumBase
@ -24,8 +24,8 @@ markdown_extensions:
# Configuration
theme:
name: material
logo: img/logo3a.png
favicon: img/logo3a.png
logo: img/grad_logo.png
favicon: img/logo4.png
include_homepage_in_sidebar: true
sticky_navigation: true
language: en
@ -53,7 +53,7 @@ plugins:
on_pre_build: docs.prepare:main
# Page tree
nav:
- SeleniumBase Docs: README.md
- SeleniumBase - Docs: README.md
- Features List: help_docs/features_list.md
- Running Example Tests: examples/ReadMe.md
- Command Line Options: help_docs/customizing_test_runs.md