Skip to content

Commit e3d4deb

Browse files
committed
Allow truncated URLs in UC Mode
1 parent 5d9fdc0 commit e3d4deb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ def uc_special_open_if_cf(
397397

398398

399399
def uc_open(driver, url):
400+
if url.startswith("//"):
401+
url = "https:" + url
402+
elif ":" not in url:
403+
url = "https://" + url
400404
if (url.startswith("http:") or url.startswith("https:")):
401405
time.sleep(0.05)
402406
with driver:
@@ -407,6 +411,10 @@ def uc_open(driver, url):
407411

408412

409413
def uc_open_with_tab(driver, url):
414+
if url.startswith("//"):
415+
url = "https:" + url
416+
elif ":" not in url:
417+
url = "https://" + url
410418
if (url.startswith("http:") or url.startswith("https:")):
411419
time.sleep(0.05)
412420
with driver:
@@ -422,6 +430,10 @@ def uc_open_with_reconnect(driver, url, reconnect_time=None):
422430
"""Open a url, disconnect chromedriver, wait, and reconnect."""
423431
if not reconnect_time:
424432
reconnect_time = constants.UC.RECONNECT_TIME
433+
if url.startswith("//"):
434+
url = "https:" + url
435+
elif ":" not in url:
436+
url = "https://" + url
425437
if (url.startswith("http:") or url.startswith("https:")):
426438
driver.execute_script('window.open("%s","_blank");' % url)
427439
driver.close()

0 commit comments

Comments
 (0)