Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,8 @@ pytest test_coffee_cart.py --trace
--verify-delay=SECONDS # (The delay before MasterQA verification checks.)
--ee | --esc-end # (Lets the user end the current test via the ESC key.)
--recorder # (Enables the Recorder for turning browser actions into code.)
--rec-sb-mgr # (A Recorder Mode that generates SB() context manager code.)
--rec-sb-cdp # (A Recorder Mode that generates Pure CDP Mode sb_cdp code.)
--rec-behave # (Same as Recorder Mode, but also generates behave-gherkin.)
--rec-sleep # (If the Recorder is enabled, also records self.sleep calls.)
--rec-print # (If the Recorder is enabled, prints output after tests end.)
Expand Down
1 change: 1 addition & 0 deletions examples/cdp_mode/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ sb.get(url, **kwargs)
sb.open(url, **kwargs) # Same as sb.get(url, **kwargs) in CDP Mode
sb.goto(url, **kwargs) # Same as sb.get(url, **kwargs) in CDP Mode
sb.reload(ignore_cache=True, script_to_evaluate_on_load=None)
sb.goto_if_not_url(url)
sb.refresh(*args, **kwargs)
sb.get_event_loop()
sb.get_rd_host() # Returns the remote-debugging host
Expand Down
2 changes: 1 addition & 1 deletion examples/cdp_mode/raw_idealista.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sb.sleep(1.5)
sb.solve_captcha()
sb.sleep(2)
sb.click("button#didomi-notice-agree-button")
sb.click_if_visible("button#didomi-notice-agree-button", timeout=3)
print("*** " + sb.get_text("h1"))
items = sb.find_elements("div.item-info-container")
for item in items:
Expand Down
2 changes: 2 additions & 0 deletions examples/raw_parameter_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
sb.recorder_ext = False
sb.record_sleep = False
sb.rec_behave = False
sb.rec_sb_mgr = False
sb.rec_sb_cdp = False
sb.rec_print = False
sb.report_on = False
sb.is_pytest = False
Expand Down
1 change: 1 addition & 0 deletions help_docs/cdp_mode_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sb.open(url, **kwargs) # Same as sb.get(url, **kwargs) in CDP Mode
sb.goto(url, **kwargs) # Same as sb.get(url, **kwargs) in CDP Mode
sb.reload(ignore_cache=True, script_to_evaluate_on_load=None)
sb.refresh(*args, **kwargs)
sb.goto_if_not_url(url)
sb.get_event_loop()
sb.get_rd_host() # Returns the remote-debugging host
sb.get_rd_port() # Returns the remote-debugging port
Expand Down
2 changes: 2 additions & 0 deletions help_docs/customizing_test_runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ pytest my_first_test.py --settings-file=custom_settings.py
--verify-delay=SECONDS # (The delay before MasterQA verification checks.)
--ee | --esc-end # (Lets the user end the current test via the ESC key.)
--recorder # (Enables the Recorder for turning browser actions into code.)
--rec-sb-mgr # (A Recorder Mode that generates SB() context manager code.)
--rec-sb-cdp # (A Recorder Mode that generates Pure CDP Mode sb_cdp code.)
--rec-behave # (Same as Recorder Mode, but also generates behave-gherkin.)
--rec-sleep # (If the Recorder is enabled, also records self.sleep calls.)
--rec-print # (If the Recorder is enabled, prints output after tests end.)
Expand Down
12 changes: 6 additions & 6 deletions help_docs/recorder_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

🔴 <b>SeleniumBase Recorder Mode</b> lets you record & export browser actions into test automation scripts.<br>

<img src="https://seleniumbase.github.io/cdn/img/sb_recorder_notification.png" title="SeleniumBase" width="380">
⏺️ Recorder Mode can be activated from the command-line interface or the desktop Recorder App. To launch the desktop app, run: `sbase recorder`:

⏺️ Recorder Mode can be activated from the command-line interface or the Recorder Desktop App.
<img src="https://seleniumbase.github.io/cdn/img/recorder_desktop_4.png" title="SeleniumBase Recorder App" width="340">

⏺️ To make a new recording from the command-line interface, use `sbase mkrec`, `sbase codegen`, or `sbase record`:
⏺️ To make a new recording from the command-line interface, use `sbase mkrec`:

```zsh
sbase mkrec TEST_NAME.py --url=URL
```

If the file already exists, you'll get an error. If no URL is provided, you'll start on a blank page and will need to navigate somewhere for the Recorder to activate. (The Recorder captures events on URLs that start with `https`, `http`, or `file`.) The command above runs an empty test that stops at a breakpoint so that you can perform manual browser actions for the Recorder. When you have finished recording, type "`c`" on the command-line and press `[ENTER]` to continue from the breakpoint. The test will complete and a file called `TEST_NAME_rec.py` will be automatically created in the `./recordings` folder. That file will get copied back to the original folder with the name you gave it. (You can run with Edge instead of Chrome by adding `--edge` to the command above. For headed Linux machines, add `--gui` to prevent the default headless mode on Linux.)
If the file already exists, you'll get an error. If no URL is provided, you'll start on a blank page and will need to navigate somewhere for the Recorder to activate. (The Recorder captures events on URLs that start with `https`, `http`, or `file`.) The command above runs an empty test that stops at a breakpoint so that you can perform manual browser actions for the Recorder. When you have finished recording, type "`c`" on the command-line and press `[ENTER]` to continue from the breakpoint. The test will complete and a file called `TEST_NAME_rec.py` will be automatically created in the `./recordings` folder. That file will get copied back to the original folder with the name you gave it. (For headed Linux machines, add `--gui` to prevent the default headless mode on Linux.)

Example:

Expand Down Expand Up @@ -55,7 +55,7 @@ sbase recorder
* Starting the SeleniumBase Recorder Desktop App...
```

<img src="https://seleniumbase.github.io/cdn/img/recorder_desktop_2.png" title="SeleniumBase" width="340">
<img src="https://seleniumbase.github.io/cdn/img/sb_recorder_notification.png" title="SeleniumBase Recorder Notification" width="380">

⏺️ While a recording is in progress, you can press the `[ESC]` key to pause the Recorder. To resume the recording, you can hit the `[~`]` key, which is located directly below the `[ESC]` key on most keyboards.

Expand Down Expand Up @@ -115,7 +115,7 @@ pytest TEST_NAME.py --trace --rec -s

⏺️ Additionally, the SeleniumBase <code>self.goto(URL)</code> method will also open a new tab for you in Recorder Mode if the domain/origin is different from the current URL. If you need to navigate to a different domain/origin from within the same tab, call <code>self.save_recorded_actions()</code> first, which saves the recorded data for later. When a recorded test completes, SeleniumBase scans the sessionStorage data of all open browser tabs for generating the completed script.

⏺️ As an alternative to activating Recorder Mode with the <code>--rec</code> command-line arg, you can also call <code>self.activate_recorder()</code> from your tests. Using the Recorder this way is only useful for tests that stay on the same URL. This is because the standard Recorder Mode functions as a Chrome extension and persists wherever the browser goes. (This version only stays on the page where called.)
⏺️ As an alternative to activating Recorder Mode with the <code>\-\-rec</code> command-line arg, you can also call <code>self.activate_recorder()</code> from your tests. Using the Recorder this way is only useful for tests that stay on the same URL. This is because the standard Recorder Mode functions as a Chrome extension and persists wherever the browser goes. (This version only stays on the page where called.)

⏺️ (Note that <b>same domain/origin</b> is not the same as <b>same URL</b>. Example: <a href="https://xkcd.com/353/" target="_blank">https://xkcd.com/353</a> and <a href="https://xkcd.com/1537/" target="_blank">https://xkcd.com/1537</a> are two different URLs with the <b>same domain/origin</b>. That means both URLs share the same sessionStorage, and that changes persist to different URLs of the same domain/origin. 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.)

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ setuptools~=70.2;python_version<"3.10"
setuptools>=82.0.1;python_version>="3.10"
wheel>=0.47.0
attrs>=26.1.0
certifi>=2026.5.20
certifi>=2026.6.17
exceptiongroup>=1.3.1
websockets~=15.0.1;python_version<"3.10"
websockets>=16.0;python_version>="3.10"
Expand Down Expand Up @@ -46,7 +46,7 @@ wsproto==1.2.0;python_version<"3.10"
wsproto~=1.3.2;python_version>="3.10"
websocket-client~=1.9.0
selenium==4.32.0;python_version<"3.10"
selenium==4.44.0;python_version>="3.10"
selenium==4.45.0;python_version>="3.10"
cssselect==1.3.0;python_version<"3.10"
cssselect>=1.4.0,<2;python_version>="3.10"
sortedcontainers==2.4.0
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.49.14"
__version__ = "4.50.0"
2 changes: 2 additions & 0 deletions seleniumbase/console_scripts/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ that are available when using SeleniumBase.
--help / -h (Display list of all available pytest options.)
--final-debug (Enter Final Debug Mode after each test ends.)
--recorder / --rec (Save browser actions as Python scripts.)
--rec-sb-mgr (Save Recorder actions as SB() context manager.)
--rec-sb-cdp (Save Recorder actions as Pure CDP Mode sb_cdp.)
--rec-behave / --rec-gherkin (Save actions as Gherkin code.)
--rec-print (Display recorded scripts when they are created.)
--save-screenshot (Save a screenshot at the end of each test.)
Expand Down
2 changes: 2 additions & 0 deletions seleniumbase/console_scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ def show_options():
op += "--help / -h (Display list of all available pytest options.)\n"
op += "--ftrace / --final-trace (Enter Debug Mode after tests end.)\n"
op += "--recorder / --rec (Save browser actions as Python scripts.)\n"
op += "--rec-sb-mgr (Save Recorder actions as SB() context manager.)\n"
op += "--rec-sb-cdp (Save Recorder actions as Pure CDP Mode sb_cdp.)\n"
op += "--rec-behave / --rec-gherkin (Save actions as Gherkin code.)\n"
op += "--rec-print (Display recorded scripts when they are created.)\n"
op += "--save-screenshot (Save a screenshot at the end of each test.)\n"
Expand Down
10 changes: 10 additions & 0 deletions seleniumbase/console_scripts/sb_mkrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def main():
use_colors = True
force_gui = False
rec_behave = False
rec_sb_mgr = False
rec_sb_cdp = False

sys_executable = sys.executable
if " " in sys_executable:
Expand Down Expand Up @@ -164,6 +166,10 @@ def main():
use_uc = True
elif option.lower() in ("--rec-behave", "--behave", "--gherkin"):
rec_behave = True
elif option.lower() in ("--rec-sb-mgr"):
rec_sb_mgr = True
elif option.lower() in ("--rec-sb-cdp"):
rec_sb_cdp = True
elif option.lower().startswith("--url="):
start_page = option[len("--url="):]
elif option.lower() == "--url":
Expand Down Expand Up @@ -306,6 +312,10 @@ def main():
run_cmd += " --uc"
if rec_behave:
run_cmd += " --rec-behave"
if rec_sb_mgr:
run_cmd += " --rec-sb-mgr"
if rec_sb_cdp:
run_cmd += " --rec-sb-cdp"
print(run_cmd)
os.system(run_cmd)
if os.path.exists(file_path):
Expand Down
Loading