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
🔴 To activate Recorder Mode, add ``--recorder`` to your ``pytest`` run command when running an existing test on Chrome or Edge. (Also add ``-s`` to allow breakpoints, unless you already have a ``pytest.ini`` file present with ``addopts = --capture=no`` in it.)
9
+
🔴 To activate Recorder Mode, add ``--rec`` OR ``--record`` OR ``--recorder`` to your ``pytest`` run command when running an existing test on Chrome or Edge. (Also add ``-s`` to allow breakpoints, unless you already have a ``pytest.ini`` file present with ``addopts = --capture=no`` in it.)
10
10
11
11
```bash
12
-
pytest TEST_NAME.py --recorder -s
12
+
pytest TEST_NAME.py --rec -s
13
13
```
14
14
15
15
🔴 To add manual actions, you'll need to create a breakpoint inside your test to activate "Debug Mode" while in "Recorder Mode": (For reference, "Debug Mode" is also known as the "ipdb debugger".)
@@ -23,7 +23,7 @@ import ipdb; ipdb.set_trace()
23
23
🔴 You can also activate Debug Mode at the start of your test by adding ``--trace`` as a ``pytest`` command-line option:
24
24
25
25
```bash
26
-
pytest TEST_NAME.py --trace --recorder -s
26
+
pytest TEST_NAME.py --trace --rec -s
27
27
```
28
28
29
29
🔴 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:
🔴 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.
44
44
45
-
<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:</p>
45
+
<p>🔴 If you want to create a recording from scratch, just run:<br><code>pytest --rec</code> on a Python file such as this one:</p>
46
46
47
47
```python
48
48
from seleniumbase import BaseCase
@@ -56,7 +56,7 @@ class RecorderTest(BaseCase):
56
56
57
57
<p>🔴 Recorder Mode works by saving your recorded actions into the browser's <code>sessionStorage</code>. SeleniumBase then reads from the browser's <code>sessionStorage</code> to take the raw data and generate a full test from it. Keep in mind that <code>sessionStorage</code> 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 <code>sessionStorage</code> 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 <code>self.open(URL)</code> 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 <code>sessionStorage</code> of all open browser tabs for the data it needs to generate the complete SeleniumBase automation script.</p>
58
58
59
-
<p>🔴 If you just want to record actions on a single URL of a multi-URL test, you can call <code>self.activate_recorder()</code> from the test instead of using <code>pytest --recorder</code> 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 <code>sessionStorage</code> data that it needs for generating a complete test.</p>
59
+
<p>🔴 If you just want to record actions on a single URL of a multi-URL test, you can call <code>self.activate_recorder()</code> from within the test instead of using <code>pytest --rec</code> 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 <code>sessionStorage</code> data that it needs for generating a complete test.</p>
60
60
61
61
<p>🔴 (Note that <b>same domain/origin</b> is not the same as <b>same URL</b>. Example: <code>https://xkcd.com/353/</code> and <code>https://xkcd.com/1537/</code> are two different URLs with the <b>same domain/origin</b>. That means that both URLs will share the same <code>sessionStorage</code> data, and that any changes to <code>sessionStorage</code> from one URL will carry on to the <code>sessionStorage</code> 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: <code>self.get_origin()</code>, which returns the value of <code>window.location.origin</code> from the browser's console.)</p>
62
62
@@ -72,10 +72,12 @@ class RecorderTest(BaseCase):
72
72
73
73
<p>🔴 SeleniumBase <code>1.66.5</code> improves the algorithm for converting recorded actions into SeleniumBase code.</p>
74
74
75
-
<p>🔴 SeleniumBase <code>1.66.6</code> adds more selector options and improves the algorithm for converting recorded actions into SeleniumBase code.</p>
75
+
<p>🔴 SeleniumBase <code>1.66.6</code> improves the algorithm for converting recorded actions into SeleniumBase code.</p>
76
76
77
77
<p>🔴 SeleniumBase <code>1.66.7</code> improves Recorder Mode post-processing and automatically adds <code>self.show_file_choosers()</code> if file-upload fields are hidden when calling <code>self.choose_file(selector, file_path)</code>.</p>
78
78
79
+
<p>🔴 SeleniumBase <code>1.66.8</code> generates better selectors in Recorder Mode and improves the algorithm for converting recorded actions into SeleniumBase code.</p>
80
+
79
81
--------
80
82
81
83
<div>To learn more about SeleniumBase, check out the Docs Site:</div>
0 commit comments