Skip to content

Commit c75e07c

Browse files
committed
Update the docs
1 parent 6c48bdd commit c75e07c

File tree

15 files changed

+134
-40
lines changed

15 files changed

+134
-40
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
<br />
3232
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">📚 API</a> |
3333
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md">📊 Reports</a> |
34-
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">♻️ Boilerplates</a> |
34+
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">♻️ Boilerplate</a> |
3535
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md">🔠 Syntaxes</a> |
36-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">🗾 Locales</a> |
37-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">🌐 Grid</a> |
38-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide/ReadMe.md">⏺️ Record</a>
36+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md">⏺️ Recorder</a> |
37+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">🗾 Locale</a> |
38+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">🌐 Grid</a>
3939
<br />
4040
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/github/workflows/ReadMe.md">🤖 CI</a> |
4141
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/translations.md">🌏 Translate</a> |
@@ -108,7 +108,7 @@ pip install -e . # Editable install
108108

109109
> (When using a virtual env, the Editable install is faster.)
110110
111-
🔵 You can also install ``seleniumbase`` from [pypi](https://pypi.python.org/pypi/seleniumbase):
111+
🔵 You can also install ``seleniumbase`` from [pypi](https://pypi.org/project/seleniumbase/):
112112

113113
```bash
114114
pip install seleniumbase
@@ -379,6 +379,7 @@ The code above will leave your browser window open in case there's a failure. (i
379379
--ad-block # (Block some types of display ads after page loads.)
380380
--block-images # (Block images from loading during tests.)
381381
--verify-delay=SECONDS # (The delay before MasterQA verification checks.)
382+
--recorder # (Enables the Recorder for turning browser actions into code.)
382383
--disable-csp # (Disable the Content Security Policy of websites.)
383384
--disable-ws # (Disable Web Security on Chromium-based browsers.)
384385
--enable-ws # (Enable Web Security on Chromium-based browsers.)

help_docs/ReadMe.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<a href="https://seleniumbase.io/help_docs/translations/">🌏 Translate</a> |
3030
<a href="https://seleniumbase.io/examples/dialog_boxes/ReadMe/">🛂 DialogBoxes</a>
3131
<br />
32-
<a href="https://seleniumbase.io/seleniumbase/utilities/selenium_ide/ReadMe/">⏺️ Recorder</a> |
32+
<a href="https://seleniumbase.io/help_docs/recorder_mode.md">⏺️ Recorder</a> |
3333
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js">🏃 NodeRunner</a>
3434
<br />
3535
<a href="https://seleniumbase.io/examples/presenter/ReadMe/">📰 Presenter</a> |
@@ -75,6 +75,7 @@
7575
<div><a href="https://seleniumbase.io/tinymce/"><b>TinyMCE Demo Page</b></a></div>
7676
<div><a href="https://seleniumbase.io/devices/"><b>Virtual Device Farm</b></a></div>
7777
<div><a href="https://seleniumbase.io/error_page/"><b>Error Page for Tests</b></a></div>
78+
<div><a href="https://seleniumbase.io/other/drag_and_drop"><b>Drag-&-Drop Test Page</b></a></div>
7879
<div><a href="https://seleniumbase.io/other/presenter.html"><b>Presenter Demo</b></a></div>
7980
<div><a href="https://seleniumbase.io/other/core_presentation.html"><b>Core Presentation</b></a></div>
8081
<div><a href="https://seleniumbase.io/other/chart_presentation.html"><b>Chart Maker Demo</b></a></div>

help_docs/customizing_test_runs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ SeleniumBase provides additional ``pytest`` command-line options for tests:
140140
--ad-block # (Block some types of display ads after page loads.)
141141
--block-images # (Block images from loading during tests.)
142142
--verify-delay=SECONDS # (The delay before MasterQA verification checks.)
143+
--recorder # (Enables the Recorder for turning browser actions into code.)
143144
--disable-csp # (Disable the Content Security Policy of websites.)
144145
--disable-ws # (Disable Web Security on Chromium-based browsers.)
145146
--enable-ws # (Enable Web Security on Chromium-based browsers.)

help_docs/features_list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Can run tests through an authenticated proxy server. (``--proxy=USER:PASS@HOST:PORT``)
2121
* Can run tests with a customized browser user agent. (``--agent=USER_AGENT_STRING``)
2222
* Can set a Chromium User Data Directory/Profile to load. (``--user_data_dir=DIR``)
23+
* Has [Recorder Mode](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md) for generating scripts from recorded actions. (``--recorder``)
2324
* Can load Chrome Extension ZIP files. (``--extension_zip=ZIP``)
2425
* Can load Chrome Extension folders. (``--extension_dir=DIR``)
2526
* Powerful [console scripts](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md). (Type **``seleniumbase``** or **``sbase``** to use.)

help_docs/install.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
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)
1+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" title="SeleniumBase" width="360" /></a>
22

33
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Installation</h2>
44

5-
#### If installing SeleniumBase directly from [PyPI](https://pypi.python.org/pypi/seleniumbase), (the Python Package Index), use:
5+
<h4>If installing SeleniumBase directly from <a href="https://pypi.python.org/pypi/seleniumbase">PyPI</a>, (the Python Package Index), use:
66

77
```bash
88
pip install seleniumbase
99
```
1010

11-
#### If installing SeleniumBase from a Git clone, use:
11+
<h4>If installing SeleniumBase from a Git clone, use:</h4>
1212

1313
```bash
1414
git clone https://github.com/seleniumbase/SeleniumBase.git
1515
cd SeleniumBase/
1616
pip install .
1717
```
1818

19-
#### For a development mode install in editable mode, use:
19+
<h4>For a development mode install in editable mode, use:</h4>
2020

2121
```bash
2222
git clone https://github.com/seleniumbase/SeleniumBase.git
2323
cd SeleniumBase/
2424
pip install -e .
2525
```
2626

27-
#### If installing SeleniumBase from a [GitHub branch](https://github.com/seleniumbase/SeleniumBase), use:
27+
<h4>If installing SeleniumBase from a <a href="https://github.com/seleniumbase/SeleniumBase">GitHub branch</a>, use:</h4>
2828

2929
```bash
3030
pip install git+https://github.com/seleniumbase/SeleniumBase.git@master#egg=seleniumbase
3131
```
3232

33-
#### Useful ``pip`` options include:
34-
* Add ``--upgrade`` OR ``-U`` to upgrade an installation.
35-
* Add ``--force-reinstall`` for a clean install.
33+
<h3><code>pip install</code> can be customized:</h3>
3634

37-
(If you're not using a virtual environment, you may need to add ``--user`` to your ``pip`` command if you're seeing errors during installation.)
35+
> (Add ``--upgrade`` OR ``-U`` to upgrade an installation.)
36+
> (Add ``--force-reinstall`` to upgrade dependencies.)
37+
> (Use ``pip3`` if multiple versions of Python are installed.)
38+
39+
(If you're not using a virtual environment, you may need to add <code>--user</code> to your <code>pip</code> command if you're seeing errors during installation.)

help_docs/locale_codes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
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:
44

55
```bash
6-
--locale=CODE # Example: --locale=ru
6+
pytest --locale=CODE # Example: --locale=ru
77
```
88

99
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="25" /> List of Language Locale Codes:</h3>

help_docs/method_summary.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ self.refresh_page()
4646

4747
self.get_current_url()
4848

49+
self.get_origin()
50+
4951
self.get_page_source()
5052

5153
self.get_title()
@@ -61,6 +63,8 @@ self.go_forward()
6163

6264
self.open_start_page()
6365

66+
self.open_if_not_url(url)
67+
6468
self.is_element_present(selector, by=By.CSS_SELECTOR)
6569

6670
self.is_element_visible(selector, by=By.CSS_SELECTOR)
@@ -120,6 +124,8 @@ self.click_nth_visible_element(selector, number, by=By.CSS_SELECTOR, timeout=Non
120124

121125
self.click_if_visible(selector, by=By.CSS_SELECTOR)
122126

127+
self.click_active_element()
128+
123129
self.is_selected(selector, by=By.CSS_SELECTOR, timeout=None)
124130
# Duplicates: self.is_checked(selector, by=By.CSS_SELECTOR, timeout=None)
125131

@@ -241,6 +247,8 @@ self.activate_design_mode()
241247

242248
self.deactivate_design_mode()
243249

250+
self.activate_recorder()
251+
244252
self.activate_jquery()
245253

246254
self.bring_to_front(selector, by=By.CSS_SELECTOR)

help_docs/mobile_testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img src="https://seleniumbase.io/cdn/img/sb_text_f.png" alt="SeleniumBase" title="SeleniumBase" width="290" /></a></p>
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>
22

33
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Mobile Testing</h2>
44

help_docs/recorder_mode.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="296">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
2+
3+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Recorder Mode</h2>
4+
5+
SeleniumBase <b>Recorder Mode</b> gives you the power to create automation scripts from manual browser actions.<br>(<i>Only Chromium browsers such as Chrome and Edge are supported.</i>)
6+
7+
<img src="https://seleniumbase.io/cdn/img/sb_recorder_notification.png" title="SeleniumBase" width="380">
8+
9+
To activate Recorder Mode, add ``--recorder`` to your ``pytest`` run command when running an existing test:
10+
11+
```bash
12+
pytest TEST_NAME.py --recorder
13+
```
14+
15+
In order to add actions to the test being run, you'll need to create a breakpoint somewhere inside your test:
16+
17+
```python
18+
import ipdb; ipdb.set_trace()
19+
```
20+
21+
Once you've reached the breakpoint, you can take control of the browser and add in any actions that you want recorded. When you are finished recording, type "``c``" on the command-line and press ``[Enter]`` to let the test continue from the breakpoint. After the test completes, a file called ``TEST_NAME_rec.py`` will be automatically created in the ``./recordings`` folder, which will include the actions performed by the test, and the manual actions that you added in. Below is a command-line notification:
22+
23+
```bash
24+
>>> RECORDING saved to: recordings/my_first_test_rec.py
25+
*******************************************************
26+
```
27+
28+
While a recording is in progress, you can hit the ``[ESC]`` key to pause the recording. To resume the recording, you can hit the ``[~`]`` key, which is located directly below the ``[ESC]`` key on most keyboards.
29+
30+
<p>If you want to create a recording from scratch, just run:<br><code>pytest --recorder</code> on a Python file such as this one:
31+
32+
```python
33+
from seleniumbase import BaseCase
34+
35+
class RecorderTest(BaseCase):
36+
def test_recorder(self):
37+
import ipdb; ipdb.set_trace()
38+
```
39+
40+
The above file gives you a basic SeleniumBase file with a breakpoint in it so that you can immediately start recording after you've opened a new web page in the browser.
41+
42+
Recorder Mode works by saving your recorded actions into the browser's ``sessionStorage``. SeleniumBase then reads from the browser's ``sessionStorage`` to take the raw data and generate a full test from it. Keep in mind that ``sessionStorage`` is only present for a website while the browser tab remains on a web page of the same domain/origin. If you leave that domain/origin, the ``sessionStorage`` of that tab will no longer have the raw data that SeleniumBase needs to create a full recording. To compensate for this, all links to web pages of a different domain/origin will automatically open a new tab for you while in Recorder Mode. Additionally, the SeleniumBase ``self.open(URL)`` method will also open a new tab for you in Recorder Mode if the domain/origin is different from the current URL. When the recorded test completes, SeleniumBase will scan the ``sessionStorage`` of all open browser tabs for the data it needs to generate the complete SeleniumBase automation script.
43+
44+
If you just want to record actions on a single URL of a multi-URL test, you can call ``self.activate_recorder()`` from the test instead of using ``pytest --recorder`` from the command-line. When doing so, make sure that the browser tab is still on the same domain/origin at the end of the test, or else SeleniumBase will not have access to the ``sessionStorage`` data that it needs for generating a complete test.
45+
46+
(Note that **same domain/origin** is not the same as **same URL**. Example: ``https://xkcd.com/353/`` and ``https://xkcd.com/1537/`` are two different URLs with the **same domain/origin**. That means that both URLs will share the same ``sessionStorage`` data, and that any changes to ``sessionStorage`` from one URL will carry on to the ``sessionStorage`` of a different URL when the domain/origin is the same. If you want to find out a website's origin during a test, just call: ``self.get_origin()``, which returns the value of ``window.location.origin`` from the browser's console.)
47+
48+
The launch of Recorder Mode has brought a new SeleniumBase method along with it: ``self.open_if_not_url(URL)``. This method will open the URL given if the browser is not currently on that page. This is used as a method in recorded scripts when SeleniumBase detects that a click action has already brought the test to the given page. This method not only prevents an extra page load if not needed, but it also lets people know the current page of the browser at that point in the test.
49+
50+
--------
51+
52+
<div>To learn more about SeleniumBase, check out the Docs Site:</div>
53+
<a href="https://seleniumbase.io">
54+
<img src="https://img.shields.io/badge/docs-%20%20SeleniumBase.io-11BBDD.svg" alt="SeleniumBase.io Docs" /></a>
55+
56+
<div>All the code is on GitHub:</div>
57+
<a href="https://github.com/seleniumbase/SeleniumBase">
58+
<img src="https://img.shields.io/badge/✅%20💛%20View%20Code-on%20GitHub%20🌎%20🚀-02A79E.svg" alt="SeleniumBase on GitHub" /></a>

integrations/katalon/ReadMe.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
## Converting Katalon/Selenium IDE recordings into SeleniumBase test scripts
1+
### Converting Katalon recordings into SeleniumBase test scripts
22

3-
[Katalon Recorder / Selenium IDE](https://www.katalon.com/resources-center/blog/katalon-automation-recorder/) is a tool that allows you to record and playback actions performed inside a web browser. It's available as a [downloadable Chrome extension](https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid) and a [downloadable Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/katalon-automation-record/). The Katalon Recorder comes with an option to export recordings as various WebDriver test scripts, one of which is ``Python 2 (WebDriver + unittest)``. Unfortunately, these natively-exported scripts can be very messy and don't always run reliably. The purpose of this converter is to clean up and improve the scripts so that they can be used in production-level environments.
3+
### (NOTE: **[SeleniumBase now has Recorder Mode](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md)**, which is recommended over other record & playback tools.)
4+
5+
--------
6+
7+
Katalon Recorder (Selenium IDE) is a tool that allows you to record and playback actions performed inside a web browser. It's available as a [downloadable Chrome extension](https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid) and a [downloadable Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/katalon-automation-record/). The Katalon Recorder comes with an option to export recordings as various WebDriver test scripts, one of which is ``Python 2 (WebDriver + unittest)``. Unfortunately, these natively-exported scripts can be very messy and don't always run reliably. The purpose of this converter is to clean up and improve the scripts so that they can be used in production-level environments.
48

59
#### Step 1: Make a recording with the Katalon Recorder
610

@@ -12,8 +16,8 @@
1216

1317
#### Step 3: Run ``seleniumbase convert`` on your exported Python file
1418

15-
```
16-
seleniumbase convert [MY_TEST.py]
19+
```bash
20+
seleniumbase convert MY_TEST.py
1721
```
1822

1923
* You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.) This new clean & reliable SeleniumBase test script is ready to be added into your test suite for running.

integrations/selenium_ide/ReadMe.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
## Converting Katalon recordings into SeleniumBase test scripts
1+
### Converting Katalon recordings into SeleniumBase test scripts
2+
3+
### (NOTE: **[SeleniumBase now has Recorder Mode](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md)**, which is recommended over other record & playback tools.)
4+
5+
--------
26

37
Katalon Recorder (Selenium IDE) is a tool that allows you to record and playback actions performed inside a web browser. It's available as a [downloadable Chrome extension](https://chrome.google.com/webstore/detail/katalon-recorder-selenium/ljdobmomdgdljniojadhoplhkpialdid) and a [downloadable Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/katalon-automation-record/). The Katalon Recorder comes with an option to export recordings as various WebDriver test scripts, one of which is ``Python 2 (WebDriver + unittest)``. Unfortunately, these natively-exported scripts can be very messy and don't always run reliably. The purpose of this converter is to clean up and improve the scripts so that they can be used in production-level environments.
48

5-
### Step 1: Make a recording with the Katalon Recorder
9+
#### Step 1: Make a recording with the Katalon Recorder
610

711
![](https://seleniumbase.io/cdn/img/katalon_recorder_2.png "Katalon Recorder example")
812

9-
### Step 2: Export your recording as a Python 2 Webdriver script
13+
#### Step 2: Export your recording as a Python 2 Webdriver script
1014

1115
* ``{} Export`` => ``Python 2 (WebDriver + unittest)`` => ``Save As File``
1216

13-
### Step 3: Run ``seleniumbase convert`` on your exported Python file
17+
#### Step 3: Run ``seleniumbase convert`` on your exported Python file
1418

15-
```
16-
seleniumbase convert [MY_TEST.py]
19+
```bash
20+
seleniumbase convert MY_TEST.py
1721
```
1822

1923
* You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.) This new clean & reliable SeleniumBase test script is ready to be added into your test suite for running.

0 commit comments

Comments
 (0)