MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / auto

Method auto

seleniumbase/undetected/patcher.py:79–119  ·  view source on GitHub ↗
(self, executable_path=None, force=False, version_main=None)

Source from the content-addressed store, hash-verified

77 self.version_full = None
78
79 def auto(self, executable_path=None, force=False, version_main=None):
80 if executable_path:
81 self.executable_path = executable_path
82 self._custom_exe_path = True
83 if self._custom_exe_path:
84 ispatched = self.is_binary_patched(self.executable_path)
85 if not ispatched:
86 return self.patch_exe()
87 else:
88 return
89 if version_main:
90 self.version_main = version_main
91 if force is True:
92 self.force = force
93 try:
94 os.unlink(self.executable_path)
95 except PermissionError:
96 if self.force:
97 self.force_kill_instances(self.executable_path)
98 not_force = not self.force
99 return self.auto(force=not_force)
100 try:
101 if self.is_binary_patched():
102 return True # Running AND patched
103 except PermissionError:
104 pass
105 except FileNotFoundError:
106 pass
107 release = self.fetch_release_number()
108 self.version_main = release.split(".")[0]
109 self.version_full = release
110 if int(self.version_main) < 115:
111 self.unzip_package(self.fetch_package())
112 else:
113 from seleniumbase.console_scripts import sb_install
114 sb_install.main(
115 override="chromedriver %s" % self.version_main,
116 intel_for_uc=shared_utils.is_arm_mac(),
117 force_uc=True,
118 )
119 return self.patch()
120
121 def patch(self):
122 self.patch_exe()

Callers 1

__init__Method · 0.80

Calls 8

is_binary_patchedMethod · 0.95
patch_exeMethod · 0.95
force_kill_instancesMethod · 0.95
fetch_release_numberMethod · 0.95
unzip_packageMethod · 0.95
fetch_packageMethod · 0.95
patchMethod · 0.95
mainMethod · 0.80

Tested by

no test coverage detected