Skip to content

Commit c000e32

Browse files
committed
Add option to use Undetectable Mode with Recorder Mode
1 parent 349d6bf commit c000e32

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

seleniumbase/console_scripts/ReadMe.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ sbase codegen new_test.py --url=wikipedia.org
386386
``--url=URL`` (Sets the initial start page URL.)
387387
``--edge`` (Use Edge browser instead of Chrome.)
388388
``--gui`` / ``--headed`` (Use headed mode on Linux.)
389+
``--uc`` / ``--undetected`` (Use undetectable mode.)
389390
``--overwrite`` (Overwrite file when it exists.)
390391
``--behave`` (Also output Behave/Gherkin files.)
391392
@@ -404,6 +405,7 @@ sbase recorder [OPTIONS]
404405
405406
* Options:
406407
408+
``--uc`` / ``--undetected`` (Use undetectable mode.)
407409
``--behave`` (Also output Behave/Gherkin files.)
408410
409411
* Output:

seleniumbase/console_scripts/run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def show_mkrec_usage():
299299
print(" --url=URL (Sets the initial start page URL.)")
300300
print(" --edge (Use Edge browser instead of Chrome.)")
301301
print(" --gui / --headed (Use headed mode on Linux.)")
302+
print(" --uc / --undetected (Use undetectable mode.)")
302303
print(" --overwrite (Overwrite file when it exists.)")
303304
print(" --behave (Also output Behave/Gherkin files.)")
304305
print(" Output:")
@@ -324,6 +325,7 @@ def show_codegen_usage():
324325
print(" --url=URL (Sets the initial start page URL.)")
325326
print(" --edge (Use Edge browser instead of Chrome.)")
326327
print(" --gui / --headed (Use headed mode on Linux.)")
328+
print(" --uc / --undetected (Use undetectable mode.)")
327329
print(" --overwrite (Overwrite file when it exists.)")
328330
print(" --behave (Also output Behave/Gherkin files.)")
329331
print(" Output:")
@@ -343,6 +345,7 @@ def show_recorder_usage():
343345
print(" seleniumbase recorder [OPTIONS]")
344346
print(" OR: sbase recorder [OPTIONS]")
345347
print(" Options:")
348+
print(" --uc / --undetected (Use undetectable mode.)")
346349
print(" --behave (Also output Behave/Gherkin files.)")
347350
print(" Output:")
348351
print(" Launches the SeleniumBase Recorder Desktop App.")

seleniumbase/console_scripts/sb_mkrec.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
--url=URL (Sets the initial start page URL.)
2323
--edge (Use Edge browser instead of Chrome.)
2424
--gui / --headed (Use headed mode on Linux.)
25+
--uc / --undetected (Use undetectable mode.)
2526
--overwrite (Overwrite file when it exists.)
2627
--behave (Also output Behave/Gherkin files.)
2728
@@ -49,6 +50,7 @@ def invalid_run_command(msg=None):
4950
exp += " --url=URL (Sets the initial start page URL.)\n"
5051
exp += " --edge (Use Edge browser instead of Chrome.)\n"
5152
exp += " --gui / --headed (Use headed mode on Linux.)\n"
53+
exp += " --uc / --undetected (Use undetectable mode.)\n"
5254
exp += " --overwrite (Overwrite file when it exists.)\n"
5355
exp += " --behave (Also output Behave/Gherkin files.)\n"
5456
exp += " Output:\n"
@@ -87,6 +89,7 @@ def main():
8789
error_msg = None
8890
invalid_cmd = None
8991
use_edge = False
92+
use_uc = False
9093
start_page = None
9194
next_is_url = False
9295
use_colors = True
@@ -138,6 +141,8 @@ def main():
138141
elif option.lower() in ("--gui", "--headed"):
139142
if "linux" in platform:
140143
force_gui = True
144+
elif option.lower() in ("--uc", "--undetected", "--undetectable"):
145+
use_uc = True
141146
elif option.lower() in ("--rec-behave", "--behave", "--gherkin"):
142147
rec_behave = True
143148
elif option.lower().startswith("--url="):
@@ -186,6 +191,8 @@ def main():
186191
run_cmd += " --edge"
187192
if force_gui:
188193
run_cmd += " --gui"
194+
if use_uc:
195+
run_cmd += " --uc"
189196
if rec_behave:
190197
run_cmd += " --rec-behave"
191198
print(run_cmd)

seleniumbase/console_scripts/sb_recorder.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
sbase recorder [OPTIONS]
88
99
Options:
10+
--uc / --undetected (Use undetectable mode.)
1011
--behave (Also output Behave/Gherkin files.)
1112
1213
Output:
@@ -132,6 +133,12 @@ def do_recording(file_name, url, overwrite_enabled, use_chrome, window):
132133
command = "sbase mkrec %s --url=%s --gui" % (file_name, url)
133134
if not use_chrome:
134135
command += " --edge"
136+
if (
137+
"--uc" in command_args
138+
or "--undetected" in command_args
139+
or "--undetectable" in command_args
140+
):
141+
command += " --uc"
135142
command += add_on
136143
poll = None
137144
if sb_config.rec_subprocess_used:

0 commit comments

Comments
 (0)