Skip to content

Commit b6120ae

Browse files
committed
Refactor UC Mode
1 parent a68f3e6 commit b6120ae

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,11 @@ def uc_special_open_if_cf(driver, url):
183183
and has_cf(requests_get(url).text)
184184
):
185185
with driver:
186+
time.sleep(0.25)
186187
driver.execute_script('window.open("%s","_blank");' % url)
187-
driver.reconnect(0.555)
188-
driver.close()
189-
driver.switch_to.window(driver.window_handles[-1])
188+
driver.close()
189+
driver.switch_to.window(driver.window_handles[-1])
190+
time.sleep(0.11)
190191
else:
191192
driver.open(url) # The original one
192193
return None
@@ -195,8 +196,9 @@ def uc_special_open_if_cf(driver, url):
195196
def uc_open(driver, url):
196197
if (url.startswith("http:") or url.startswith("https:")):
197198
with driver:
198-
driver.open(url)
199199
time.sleep(0.25)
200+
driver.open(url)
201+
time.sleep(0.11)
200202
else:
201203
driver.open(url) # The original one
202204
return None
@@ -205,10 +207,11 @@ def uc_open(driver, url):
205207
def uc_open_with_tab(driver, url):
206208
if (url.startswith("http:") or url.startswith("https:")):
207209
with driver:
210+
time.sleep(0.25)
208211
driver.execute_script('window.open("%s","_blank");' % url)
209212
driver.close()
210213
driver.switch_to.window(driver.window_handles[-1])
211-
time.sleep(0.25)
214+
time.sleep(0.11)
212215
else:
213216
driver.open(url) # The original one
214217
return None

seleniumbase/undetected/patcher.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ def gen_call_function_js_cache_name(match):
208208
gen_js_whitespaces,
209209
file_bin,
210210
)
211+
file_bin = re.sub(
212+
b"window\\.cdc_[a-zA-Z0-9]{22}_(Array|Promise|Symbol)",
213+
b"window\\.ccd_adoQpoasnaf67pfcZLmcfl_(Array|Promise|Symbol)",
214+
file_bin,
215+
)
211216
file_bin = re.sub(
212217
b"'\\$cdc_[a-zA-Z0-9]{22}_';",
213218
gen_call_function_js_cache_name,

0 commit comments

Comments
 (0)