Make the Recorder stealthier
This commit is contained in:
parent
4c455c4675
commit
c3ce0b0e82
|
@ -181,6 +181,28 @@ def main():
|
|||
data.append("")
|
||||
data.append("class RecorderTest(BaseCase):")
|
||||
data.append(" def test_recording(self):")
|
||||
if use_uc:
|
||||
data.append(" if self.undetectable:")
|
||||
if (
|
||||
start_page
|
||||
and (
|
||||
start_page.startswith("http:")
|
||||
or start_page.startswith("https:")
|
||||
or start_page.startswith("file:")
|
||||
)
|
||||
):
|
||||
used_sp = start_page
|
||||
if '"' not in start_page:
|
||||
used_sp = '"%s"' % start_page
|
||||
elif "'" not in start_page:
|
||||
used_sp = "'%s'" % start_page
|
||||
data.append(
|
||||
" self.uc_open_with_disconnect(\n"
|
||||
" %s\n"
|
||||
" )" % used_sp
|
||||
)
|
||||
else:
|
||||
data.append(" self.disconnect()")
|
||||
data.append(" if self.recorder_ext:")
|
||||
data.append(" # When done recording actions,")
|
||||
data.append(' # type "c", and press [Enter].')
|
||||
|
@ -231,7 +253,18 @@ def main():
|
|||
)
|
||||
print(success)
|
||||
run_cmd = None
|
||||
if not start_page:
|
||||
if (
|
||||
not start_page
|
||||
or (
|
||||
use_uc
|
||||
and (
|
||||
start_page.startswith("http:")
|
||||
or start_page.startswith("https:")
|
||||
or start_page.startswith("file:")
|
||||
)
|
||||
and not esc_end
|
||||
)
|
||||
):
|
||||
run_cmd = "%s -m pytest %s --rec -q -s" % (sys_executable, file_name)
|
||||
else:
|
||||
run_cmd = "%s -m pytest %s --rec -q -s --url=%s" % (
|
||||
|
|
|
@ -197,6 +197,13 @@ def do_playback(file_name, use_chrome, window, demo_mode=False):
|
|||
command += " --edge"
|
||||
if demo_mode:
|
||||
command += " --demo"
|
||||
command_args = sys.argv[2:]
|
||||
if (
|
||||
"--uc" in command_args
|
||||
or "--undetected" in command_args
|
||||
or "--undetectable" in command_args
|
||||
):
|
||||
command += " --uc"
|
||||
poll = None
|
||||
if sb_config.rec_subprocess_used:
|
||||
poll = sb_config.rec_subprocess_p.poll()
|
||||
|
|
|
@ -16029,6 +16029,11 @@ class BaseCase(unittest.TestCase):
|
|||
# This test already called tearDown()
|
||||
return
|
||||
if hasattr(self, "recorder_mode") and self.recorder_mode:
|
||||
if self.undetectable:
|
||||
try:
|
||||
self.driver.window_handles
|
||||
except Exception:
|
||||
self.driver.connect()
|
||||
self.__process_recorded_actions()
|
||||
self.__called_teardown = True
|
||||
self.__called_setup = False
|
||||
|
|
Loading…
Reference in New Issue