From 97e430c78cfb7b8802e31fe9039f95900e7c8bd6 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Fri, 22 Apr 2022 22:57:53 -0400 Subject: [PATCH] Update the docs --- README.md | 58 +++++++++++++----- examples/ReadMe.md | 40 ++++++------- examples/example_logs/ReadMe.md | 2 - help_docs/ReadMe.md | 15 +++-- help_docs/customizing_test_runs.md | 60 ++++++++++++------- help_docs/features_list.md | 3 +- help_docs/js_package_manager.md | 40 +++++++------ help_docs/locale_codes.md | 2 +- help_docs/method_summary.md | 2 - help_docs/recorder_mode.md | 2 +- help_docs/syntax_formats.md | 2 - help_docs/translations.md | 4 +- mkdocs.yml | 1 + seleniumbase/console_scripts/ReadMe.md | 25 ++++---- seleniumbase/console_scripts/run.py | 3 +- seleniumbase/console_scripts/sb_commander.py | 9 ++- seleniumbase/console_scripts/sb_recorder.py | 2 +- .../utilities/selenium_grid/ReadMe.md | 5 +- 18 files changed, 163 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index f38b8304..39261965 100755 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ -

SeleniumBase

+

SeleniumBase

-

Better web testing with Selenium and pytest.

+

Modern Web Testing with Selenium and Pytest.

Latest Release on GitHub @@ -20,32 +20,61 @@

🚀 Start | 🏰 Features | -👩‍đŸĢ Examples | -đŸ–Ĩī¸ Options | -🧙 Scripts | -📱 Mobile | -đŸ–ŧī¸ Visual +✅ Examples | +🎛ī¸ Options | +🔮 Scripts | +🎖ī¸ Cmdr | +🕹ī¸ JSMgr
📚 API | -đŸ”ĩ Dashboard | 🔴 Recorder | -🔠 Syntaxes | -🗾 Locales | +đŸ”ĩ Dashboard | +🔠 Formats | +📱 Mobile | 🌐 Grid | -🕹ī¸ JSMgr +🛂 Dialog
🤖 CI | â™ģī¸ Templates | -🎞ī¸ Presenter | 🌏 Translator | +🎞ī¸ Presenter | 📊 Charts | đŸ—ēī¸ Tours | -🛂 Dialog +đŸ–ŧī¸ Visual

-------- -

One of many examples: test_demo_site.py

+

An example test using the BaseCase class:

+ +```python +from seleniumbase import BaseCase + +class Test_MFA_Login(BaseCase): + def test_mfa_login(self): + self.open("https://seleniumbase.io/realworld/login") + self.type("input#username", "demo_user") + self.type("input#password", "secret_pass") + self.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") + self.click('a:contains("This Page")') + self.assert_text("Welcome!", "h1") + self.save_screenshot_to_logs() +``` + +

An example test using the sb fixture:

+ +```python +def test_mfa_login(sb): + sb.open("https://seleniumbase.io/realworld/login") + sb.type("input#username", "demo_user") + sb.type("input#password", "secret_pass") + sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") + sb.click('a:contains("This Page")') + sb.assert_text("Welcome!", "h1") + sb.save_screenshot_to_logs() +``` + +

An example of running a test: test_demo_site.py

```bash cd examples/ @@ -54,7 +83,6 @@ pytest test_demo_site.py

SeleniumBase Demo Mode

-

Python Setup:

diff --git a/examples/ReadMe.md b/examples/ReadMe.md index 2545bf89..d2651f6d 100755 --- a/examples/ReadMe.md +++ b/examples/ReadMe.md @@ -1,5 +1,3 @@ -

SeleniumBase

-

Running Example Tests:

SeleniumBase Demo Page

@@ -15,7 +13,7 @@

Example tests with run commands to help you get started:

-Run an example test in Chrome: (Default: ``--browser=chrome``) +Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) in Chrome: (Default: ``--browser=chrome``) ```bash pytest my_first_test.py @@ -23,6 +21,14 @@ pytest my_first_test.py
+Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py) on the SeleniumBase Demo Site: + +```bash +pytest test_demo_site.py +``` + +
+ Run an example test in Firefox: ```bash @@ -37,7 +43,7 @@ pytest test_swag_labs.py --demo
-Run a Wordle-solver example: +Run a [Wordle-solver example](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/wordle_test.py): ```bash pytest wordle_test.py @@ -51,7 +57,7 @@ Run an example test in Headless Mode: (invisible browser) pytest my_first_test.py --headless ``` -Run an example test using Chrome's mobile device emulator: (default settings) +Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_swag_labs.py) using Chrome's mobile device emulator: (default settings) ```bash pytest test_swag_labs.py --mobile @@ -59,27 +65,19 @@ pytest test_swag_labs.py --mobile
-Run tests with verbose output: (includes more details) +Run a [test suite](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_suite.py) with verbose output: (see more details) ```bash pytest test_suite.py -v ``` -Run a test on the Demo Site to try many SeleniumBase methods: - -```bash -pytest test_demo_site.py -``` - -
- -Run tests multi-threaded using [n] threads: +Run a test suite multi-threaded using [n] threads: ```bash pytest test_suite.py -n=4 ``` -Run a parameterized test: (Generates multiple tests from one) +Run a [parameterized test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/parameterized_test.py): (Generates multiple tests from one) ```bash pytest parameterized_test.py -v @@ -97,7 +95,7 @@ Run a test suite and generate a pytest report: pytest test_suite.py --html=report.html ``` -Run a failing test: (See the ``latest_logs/`` folder for logs and screenshots) +Run a [failing test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_fail.py): (See the ``latest_logs/`` folder for logs and screenshots) ```bash pytest test_fail.py @@ -109,25 +107,25 @@ Run a failing test with Debug-mode enabled: (``pdb`` activates on failures) pytest test_fail.py --pdb -s ``` -Run an example test suite that demonstrates the use of pytest markers: +Run a test suite that demonstrates the use of pytest markers: ```bash pytest -m marker_test_suite -v ``` -Run an example test suite that reuses the browser session between tests: +Run a test suite that reuses the browser session between tests: ```bash pytest test_suite.py --reuse-session ``` -Run an example test demonstrating the ``rate_limited`` Python decorator: +Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/rate_limiting_test.py) demonstrating the ``rate_limited`` Python decorator: ```bash pytest rate_limiting_test.py ``` -Run an example test that demonstrates how to upload a file to a website: +Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/upload_file_test.py) that demonstrates how to upload a file to a website: ```bash pytest upload_file_test.py diff --git a/examples/example_logs/ReadMe.md b/examples/example_logs/ReadMe.md index 0a732938..826c2f01 100755 --- a/examples/example_logs/ReadMe.md +++ b/examples/example_logs/ReadMe.md @@ -1,5 +1,3 @@ -

SeleniumBase

-

Logs, The Dashboard, and Reports:

diff --git a/help_docs/ReadMe.md b/help_docs/ReadMe.md index b52e4521..3b0d322f 100755 --- a/help_docs/ReadMe.md +++ b/help_docs/ReadMe.md @@ -1,13 +1,12 @@ -
SeleniumBase
-

Help Docs

-🚀 Start | -đŸ–Ĩī¸ CLI | -🏰 Features +🚀 Start
-👨‍đŸĢ Examples | +🏰 Features | +🎛ī¸ Options +
+✅ Examples | 📱 Mobile
🔠 Syntax Formats | @@ -17,7 +16,7 @@ 📊 Reports | đŸ—ēī¸ Tours
-🧙‍ Console Scripts | +🔮 Console Scripts | 🌐 Grid
â™ģī¸ Boilerplates | @@ -33,7 +32,7 @@ 🏃 NodeRunner
🎞ī¸ Presenter | -đŸ“ļ ChartMaker +📊 ChartMaker

-------- diff --git a/help_docs/customizing_test_runs.md b/help_docs/customizing_test_runs.md index bbea00ec..ae8ea2dc 100755 --- a/help_docs/customizing_test_runs.md +++ b/help_docs/customizing_test_runs.md @@ -1,10 +1,8 @@ -

SeleniumBase

+

pytest options for SeleniumBase

-## pytest options for SeleniumBase +🎛ī¸ 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. -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. - -Here are some examples of configuring tests, which can be run from the [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder: +🎛ī¸ Here are some examples of configuring tests, which can be run from the [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder: ```bash # Run a test in Chrome (default browser) @@ -77,11 +75,11 @@ pytest test_swag_labs.py --mobile --metrics="411,731,3" pytest my_first_test.py --settings-file=custom_settings.py ``` -You can interchange ``pytest`` with ``nosetests`` for most tests, but using ``pytest`` is recommended. (``chrome`` is the default browser if not specified.) +🎛ī¸ You can interchange ``pytest`` with ``nosetests`` for most tests, but using ``pytest`` is recommended. (``chrome`` is the default browser if not specified.) -If you're using ``pytest`` for running tests outside of the SeleniumBase repo, you'll want a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure. If using ``nosetests``, the same applies for [setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg). +🎛ī¸ If you're using ``pytest`` for running tests outside of the SeleniumBase repo, you'll want a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure. If using ``nosetests``, the same applies for [setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg). -Here are some useful command-line options that come with ``pytest``: +🎛ī¸ Here are some useful command-line options that come with ``pytest``: ```bash -v # Verbose mode. Prints the full name of each test run. @@ -96,7 +94,7 @@ Here are some useful command-line options that come with ``pytest``: -m=MARKER # Run tests with the specified pytest marker. ``` -SeleniumBase provides additional ``pytest`` command-line options for tests: +🎛ī¸ SeleniumBase provides additional ``pytest`` command-line options for tests: ```bash --browser=BROWSER # (The web browser to use. Default: "chrome".) @@ -171,7 +169,7 @@ SeleniumBase provides additional ``pytest`` command-line options for tests: (For more details, see the full list of command-line options **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py)**.) -You can also view a list of popular ``pytest`` options for SeleniumBase by typing: +🎛ī¸ You can also view a list of popular ``pytest`` options for SeleniumBase by typing: ```bash seleniumbase options @@ -245,7 +243,7 @@ The code above will leave your browser window open in case there's a failure. (i

Combinations of options:

-There are times when you'll want to combine various command-line options for added effect. +🎛ī¸ There are times when you'll want to combine various command-line options for added effect. For instance, the multi-process option, ``-n=4``, can be customized by adding: ``--dist=loadscope`` or ``--dist=loadfile`` to it. Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/pytest-xdist/): @@ -254,7 +252,7 @@ Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/ * ``-n=4 --dist=loadfile``: Tests are grouped by their containing file. Groups are distributed to available workers as whole units. This guarantees that all tests in a file run in the same worker. -You might also want to combine multiple options at once. For example: +🎛ī¸ You might also want to combine multiple options at once. For example: ```bash pytest -n=4 --reuse-session --headless -v --dashboard --html=report.html @@ -336,20 +334,36 @@ nosetests test_suite.py --report -------- +

Language Locale Codes

+ +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: + +```bash +pytest --locale=CODE # Example: --locale=ru +``` + +Visit 🗾 Locales for a full list of codes. + +-------- +

Customizing default settings:

-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. +🎛ī¸ 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`` + +```bash +pytest --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.) --------

Running tests on a remote Selenium Grid:

-SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [LambdaTest](https://www.lambdatest.com/selenium-automation)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, other Grids, and even your own Grid: +🌐 SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [LambdaTest](https://www.lambdatest.com/selenium-automation)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, other Grids, and even your own Grid: -(For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities) +🌐 For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities Here's how to connect to a BrowserStack Selenium Grid server for running tests: @@ -387,9 +401,9 @@ Here's how to connect to a CrossBrowserTesting Selenium Grid server for running pytest test_demo_site.py --server=USERNAME:KEY@hub.crossbrowsertesting.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)) +🌐 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)) -To use a server on the ``https`` protocol, add ``--protocol=https``: (*Now automatic if the port is 443.*) +🌐 To use a server on the ``https`` protocol, add ``--protocol=https``: (*Now automatic if the port is 443.*) ```bash pytest test_demo_site.py --protocol=https --server=IP_ADDRESS --port=PORT @@ -399,19 +413,19 @@ pytest test_demo_site.py --protocol=https --server=IP_ADDRESS --port=PORT

Using a Proxy Server:

-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. +🌐 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. ```bash 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): +🌐 If the proxy server that you wish to use requires authentication, you can do the following (Chromium only): ```bash pytest proxy_test.py --proxy=USERNAME:PASSWORD@IP_ADDRESS:PORT ``` -SeleniumBase also supports SOCKS4 and SOCKS5 proxies: +🌐 SeleniumBase also supports SOCKS4 and SOCKS5 proxies: ```bash pytest proxy_test.py --proxy="socks4://IP_ADDRESS:PORT" @@ -429,7 +443,7 @@ pytest proxy_test.py --proxy=proxy1

Changing the User-Agent:

-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. +🔤 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. ```bash pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU" @@ -437,7 +451,7 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1

Mobile Device Testing:

-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/). +📱 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/). ```bash # Run tests using Chrome's mobile device emulator (default settings) diff --git a/help_docs/features_list.md b/help_docs/features_list.md index 5542134f..bc3e331d 100755 --- a/help_docs/features_list.md +++ b/help_docs/features_list.md @@ -1,5 +1,3 @@ -

SeleniumBase

-

(Watch the tutorial on YouTube)

@@ -31,6 +29,7 @@ * Includes [Chart Maker](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md), a tool for creating interactive charts. * Includes a [dialog box builder](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/dialog_boxes/ReadMe.md) to allow user-input during automation. * Includes a [website tour builder](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md) for creating interactive walkthroughs. +* Includes a GUI for running pytest scripts: [SeleniumBase Commander](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/commander.md). * Includes integrations for [GitHub Actions](https://seleniumbase.io/integrations/github/workflows/ReadMe/), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), [Azure](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md), [S3](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/s3_logging_plugin.py), and [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md). * Can handle Google Authenticator logins with [Python's one-time password library](https://pyotp.readthedocs.io/en/latest/). * Can load and make assertions on PDF files from websites or the local file system. diff --git a/help_docs/js_package_manager.md b/help_docs/js_package_manager.md index c23777ee..d3be3cc5 100755 --- a/help_docs/js_package_manager.md +++ b/help_docs/js_package_manager.md @@ -1,23 +1,27 @@ -

SeleniumBase

-

JS Package Manager and Code Generators

-
SeleniumBase lets you load JavaScript packages from any CDN link into any website.
+

🕹ī¸ SeleniumBase lets you load JavaScript packages from any CDN link into any website.

-

In addition to loading JS packages, SeleniumBase also lets you generate JS code from Python so that you can use these packages more easily.

+🎨 The following SeleniumBase solutions utilize this feature: -

Here's an example of loading a website-tour library into the browser for a Google Maps tour:

+đŸ—ēī¸ Website Tours - 🎞ī¸ Presenter - 📊 Chart Maker - 🛂 Dialog Boxes + +

🕹ī¸ In addition to loading JS packages, SeleniumBase also lets you generate JS code from Python so that you can use these packages more easily.

+ +

đŸ—ēī¸ Here's an example of loading a website-tour library into the browser for a Google Maps tour:


-This example, ([maps_introjs_tour.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/maps_introjs_tour.py) from the SeleniumBase ``examples/tour_examples/`` folder), can be run with ``pytest`` after you've cloned and installed [SeleniumBase from GitHub](https://github.com/seleniumbase/SeleniumBase): (The ``--interval=1`` makes the tour go automatically to the next step after 1 second.) +

đŸ—ēī¸ This example is from maps_introjs_tour.py. (The --interval=1 makes the tour go automatically to the next step after 1 second.)

```bash cd examples/tour_examples pytest maps_introjs_tour.py --interval=1 ``` -

SeleniumBase includes powerful JS code generators for converting Python into JavaScript for using the supported JS packages. A few lines of Python in your tests might generate hundreds of lines of JavaScript. (Here is some tour code in Python from maps_introjs_tour.py that expands into a lot of JavaScript.)

+

🕹ī¸ SeleniumBase includes powerful JS code generators for converting Python into JavaScript for using the supported JS packages. A few lines of Python in your tests might generate hundreds of lines of JavaScript.

+ +

đŸ—ēī¸ Here is some tour code in Python from maps_introjs_tour.py that expands into a lot of JavaScript.

```python self.open("https://www.google.com/maps/@42.3591234,-71.0915634,15z") @@ -30,21 +34,21 @@ self.export_tour(filename="maps_introjs_tour.js") self.play_tour() ``` -

For existing features, SeleniumBase already takes care of loading all the necessary JS and CSS files into the web browser. To load other packages, here are a few useful methods that you should know about:

+

🕹ī¸ For existing features, SeleniumBase already takes care of loading all the necessary JS and CSS files into the web browser. To load other packages, here are a few useful methods that you should know about:

```python self.add_js_link(js_link) ``` -
This example loads the IntroJS JavaScript library:
+

🕹ī¸ This example loads the IntroJS JavaScript library:

```python self.add_js_link("https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js") ``` -
You can load any JS package this way as long as you know the URL.
+
🕹ī¸ You can load any JS package this way as long as you know the URL.
-If you're wondering how SeleniumBase does this, here's the full Python code from [js_utils.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/js_utils.py), which uses WebDriver's ``execute_script()`` method for making JS calls after escaping quotes with backslashes as needed: +

🕹ī¸ If you're wondering how SeleniumBase does this, here's the full Python code from js_utils.py, which uses WebDriver's execute_script() method for making JS calls after escaping quotes with backslashes as needed:

```python def add_js_link(driver, js_link): @@ -64,19 +68,19 @@ def add_js_link(driver, js_link): driver.execute_script(script_to_add_js % js_link) ``` -

Now that you've loaded JavaScript into the browser, you may also want to load some CSS to go along with it:

+

🕹ī¸ Now that you've loaded JavaScript into the browser, you may also want to load some CSS to go along with it:

```python self.add_css_link(css_link) ``` -

Here's code that loads the IntroJS CSS:

+

🕹ī¸ Here's code that loads the IntroJS CSS:

```python self.add_css_link("https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/introjs.css") ``` -

And here's the Python WebDriver code that makes this possible:

+

🕹ī¸ And here's the Python WebDriver code that makes this possible:

```python def add_css_link(driver, css_link): @@ -95,8 +99,8 @@ def add_css_link(driver, css_link): driver.execute_script(script_to_add_css % css_link) ``` -
Website tours are just one of the many uses of the JS Package Manager.
-

The following example shows the JqueryConfirm package loaded into a website for creating fancy dialog boxes:

+
🕹ī¸ Website tours are just one of the many uses of the JS Package Manager.
+

🛂 The following example shows the JqueryConfirm package loaded into a website for creating fancy dialog boxes:

SeleniumBase @@ -113,7 +117,7 @@ pytest test_dialog_boxes.py

(Example from the Dialog Boxes ReadMe)

-
Since packages are loaded directly from a CDN link, you won't need other package managers like NPM, Bower, or Yarn to get the packages that you need into the websites that you want.
+
🕹ī¸ Since packages are loaded directly from a CDN link, you won't need other package managers like NPM, Bower, or Yarn to get the packages that you need into the websites that you want.
-------- @@ -127,4 +131,4 @@ pytest test_dialog_boxes.py SeleniumBase on GitHub -And if you're just interested in creating website tours with SeleniumBase, here's the link to the Website Tours ReadMe. +đŸ—ēī¸ If you're only interested in creating website tours with SeleniumBase, here's the link to the Website Tours ReadMe. diff --git a/help_docs/locale_codes.md b/help_docs/locale_codes.md index e200a44e..299d7d11 100755 --- a/help_docs/locale_codes.md +++ b/help_docs/locale_codes.md @@ -1,6 +1,6 @@

Language Locale Codes

-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 adding: +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: ```bash pytest --locale=CODE # Example: --locale=ru diff --git a/help_docs/method_summary.md b/help_docs/method_summary.md index 32e76ee0..c0400f7b 100755 --- a/help_docs/method_summary.md +++ b/help_docs/method_summary.md @@ -1,5 +1,3 @@ -

SeleniumBase

-

Methods (API Reference)

diff --git a/help_docs/recorder_mode.md b/help_docs/recorder_mode.md index 7aefddfc..232de338 100755 --- a/help_docs/recorder_mode.md +++ b/help_docs/recorder_mode.md @@ -7,7 +7,7 @@ -🔴 To make a new recording with Recorder Mode, you can use ``sbase mkrec``, ``sbase codegen``, or ``sbase record``): +🔴 To make a new recording with Recorder Mode, use ``sbase mkrec``, ``sbase codegen``, or ``sbase record``): ```bash sbase mkrec TEST_NAME.py --url=URL diff --git a/help_docs/syntax_formats.md b/help_docs/syntax_formats.md index d37795d7..fcbc1025 100755 --- a/help_docs/syntax_formats.md +++ b/help_docs/syntax_formats.md @@ -1,5 +1,3 @@ -

SeleniumBase

-

The 17 syntax formats

diff --git a/help_docs/translations.md b/help_docs/translations.md index bea70c32..817bde3c 100755 --- a/help_docs/translations.md +++ b/help_docs/translations.md @@ -1,7 +1,7 @@ -

+

-

Language Tests (Python 3+)

+

🌏 Language Tests & Translation API

SeleniumBase supports the following 10 languages: English, Chinese, Dutch, French, Italian, Japanese, Korean, Portuguese, Russian, and Spanish. diff --git a/mkdocs.yml b/mkdocs.yml index 0b112817..04d5c569 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -82,6 +82,7 @@ nav: - Running Example Tests: examples/ReadMe.md - Command Line Options: help_docs/customizing_test_runs.md - Dashboard / Reports: examples/example_logs/ReadMe.md + - SeleniumBase Commander: help_docs/commander.md - Console Scripts: seleniumbase/console_scripts/ReadMe.md - Syntax Formats: help_docs/syntax_formats.md - Recorder Mode: help_docs/recorder_mode.md diff --git a/seleniumbase/console_scripts/ReadMe.md b/seleniumbase/console_scripts/ReadMe.md index dac4b509..18e6c37f 100755 --- a/seleniumbase/console_scripts/ReadMe.md +++ b/seleniumbase/console_scripts/ReadMe.md @@ -1,8 +1,6 @@ -

SeleniumBase

+

🔮 Console Scripts 🔮

-

Console Scripts

- -SeleniumBase console scripts help you get things done more easily, such as installing web drivers, creating a test directory with necessary configuration files, converting old WebDriver unittest scripts into SeleniumBase code, translating tests into multiple languages, and using the Selenium Grid. +⭐ SeleniumBase console scripts help you get things done more easily, such as installing web drivers, creating a test directory with useful configuration files, initializing the SeleniumBase Recorder, launching the SeleniumBase Commander, translating tests into multiple languages, and running a Selenium Grid. * Usage: ``seleniumbase [COMMAND] [PARAMETERS]`` @@ -147,14 +145,21 @@ For the full list of command-line options, type: "pytest --help".

commander / gui

* Usage: -``sbase commander [OPTIONAL PATH or TEST FILE]`` -``sbase gui [OPTIONAL PATH or TEST FILE]`` + +```bash +sbase commander [OPTIONAL PATH or TEST FILE] +sbase gui [OPTIONAL PATH or TEST FILE] +``` * Examples: -``sbase gui`` -``sbase gui -k agent`` -``sbase gui examples/`` -``sbase gui test_suite.py`` + +```bash +sbase gui +sbase gui -k agent +sbase gui -m marker2 +sbase gui test_suite.py +sbase gui offline_examples/ +``` * Output: Launches SeleniumBase Commander | GUI for pytest. diff --git a/seleniumbase/console_scripts/run.py b/seleniumbase/console_scripts/run.py index e2b96c74..5aa994fb 100644 --- a/seleniumbase/console_scripts/run.py +++ b/seleniumbase/console_scripts/run.py @@ -163,8 +163,9 @@ def show_commander_usage(): print(" Examples:") print(" sbase gui") print(" sbase gui -k agent") - print(" sbase gui examples/") + print(" sbase gui -m marker2") print(" sbase gui test_suite.py") + print(" sbase gui offline_examples/") print(" Output:") print(" Launches SeleniumBase Commander | GUI for pytest.") print("") diff --git a/seleniumbase/console_scripts/sb_commander.py b/seleniumbase/console_scripts/sb_commander.py index a98d42d1..f6071c92 100755 --- a/seleniumbase/console_scripts/sb_commander.py +++ b/seleniumbase/console_scripts/sb_commander.py @@ -8,8 +8,15 @@ Usage: seleniumbase gui [OPTIONAL PATH or TEST FILE] sbase gui [OPTIONAL PATH or TEST FILE] +Examples: + sbase gui + sbase gui -k agent + sbase gui -m marker2 + sbase gui test_suite.py + sbase gui offline_examples/ + Output: - Launches SeleniumBase Commander | GUI for pytest. + Launches SeleniumBase Commander | GUI for pytest. """ import colorama diff --git a/seleniumbase/console_scripts/sb_recorder.py b/seleniumbase/console_scripts/sb_recorder.py index 747bcf92..ab8e2ea6 100755 --- a/seleniumbase/console_scripts/sb_recorder.py +++ b/seleniumbase/console_scripts/sb_recorder.py @@ -7,7 +7,7 @@ Usage: sbase recorder Output: - Launches the SeleniumBase Recorder Desktop App. + Launches the SeleniumBase Recorder Desktop App. """ import colorama diff --git a/seleniumbase/utilities/selenium_grid/ReadMe.md b/seleniumbase/utilities/selenium_grid/ReadMe.md index 4b30e13c..f2e1f547 100755 --- a/seleniumbase/utilities/selenium_grid/ReadMe.md +++ b/seleniumbase/utilities/selenium_grid/ReadMe.md @@ -95,5 +95,6 @@ pytest test_demo_site.py --protocol=https --server=IP_ADDRESS --port=PORT (For setting browser desired capabilities while running Selenium remotely, see the desired capabilities documentation and the sample files located in SeleniumBase/examples/capabilities) -

More info about the Selenium Grid Hub can be found here:

-* [https://github.com/SeleniumHQ/selenium/wiki/Grid2](https://github.com/SeleniumHQ/selenium/wiki/Grid2) +

More info about the Selenium Grid Hub can be found here:

+ +* [https://www.selenium.dev/documentation/grid/](https://www.selenium.dev/documentation/grid/)