You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Reuse the browser session for all tests being run
25
+
# Reuse the browser session for all tests ("--rs")
26
26
pytest test_suite.py --reuse-session
27
27
28
-
# Reuse the browser session, but empty cookies between tests
28
+
# Reuse the browser session, but erase cookies between tests
29
29
pytest test_suite.py --reuse-session --crumbs
30
30
31
31
# Create a real-time dashboard for test results
@@ -182,7 +182,7 @@ sbase options
182
182
183
183
--------
184
184
185
-
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Example tests using Logging:</h3>
185
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Example tests using Logging:</h3>
186
186
187
187
To see logging abilities, you can run a test suite that includes tests that fail on purpose:
188
188
@@ -192,7 +192,7 @@ pytest test_suite.py
192
192
193
193
🔵 During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is specified (or if ARCHIVE_EXISTING_LOGS is set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py)), test logs will also get archived to the ``archived_logs/`` folder. Otherwise, the log files will be cleaned out when the next test run begins (by default).
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:
198
198
@@ -206,23 +206,23 @@ You can override the default wait time by either updating [settings.py](https://
206
206
pytest my_first_test.py --demo --demo-sleep=1.2
207
207
```
208
208
209
-
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Passing additional data to tests:</h3>
209
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Passing additional data to tests:</h3>
210
210
211
211
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.
You can use ``--reruns=NUM`` to retry failing tests that many times. Use ``--reruns-delay=SECONDS`` to wait that many seconds between retries. Example:
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
242
242
243
-
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Combinations of options:</h3>
243
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Combinations of options:</h3>
244
244
245
245
There are times when you'll want to combine various command-line options for added effect.
246
246
For instance, the multi-process option, ``-n=4``, can be customized by adding:
@@ -261,7 +261,7 @@ The above not only runs tests in parallel processes, but it also tells tests in
261
261
262
262
--------
263
263
264
-
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="32" /> The SeleniumBase Dashboard:</h3>
264
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> The SeleniumBase Dashboard:</h3>
265
265
266
266
🔵 The ``--dashboard`` option for pytest generates a SeleniumBase Dashboard located at ``dashboard.html``, which updates automatically as tests run and produce results. Example:
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.
339
339
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))
@@ -342,9 +342,9 @@ Here's the command-line option to add to tests: (See [examples/custom_settings.p
342
342
343
343
--------
344
344
345
-
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Running tests on a remote Selenium Grid:</h3>
345
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Running tests on a remote Selenium Grid:</h3>
346
346
347
-
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:
347
+
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, other Grids, and even your own Grid:
348
348
349
349
(For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities)
350
350
@@ -360,16 +360,16 @@ Here's how to connect to a Sauce Labs Selenium Grid server for running tests:
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))
382
388
383
-
To use a server on the ``https`` protocol, add ``--protocol=https``:
389
+
To use a server on the ``https`` protocol, add ``--protocol=https``: (*Now automatic if the port is 443.*)
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Using a Proxy Server:</h3>
397
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Using a Proxy Server:</h3>
392
398
393
399
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.
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Changing the User-Agent:</h3>
427
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Changing the User-Agent:</h3>
422
428
423
429
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.
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Mobile Device Testing:</h3>
435
+
<h3><imgsrc="https://seleniumbase.io/img/green_logo.png"title="SeleniumBase"width="32" /> Mobile Device Testing:</h3>
430
436
431
437
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/).
0 commit comments