Skip to content

Commit 2c25456

Browse files
committed
Accept URLs without the protocol in sb.driver.get(url)
1 parent 968f0d2 commit 2c25456

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ def uc_execute_cdp_cmd(driver, *args, **kwargs):
470470
return driver.default_execute_cdp_cmd(*args, **kwargs)
471471

472472

473+
def updated_get(driver, url):
474+
if url and ":" not in url and "." in url:
475+
url = "https:" + url
476+
driver.default_get(url)
477+
478+
473479
def uc_special_open_if_cf(
474480
driver,
475481
url,
@@ -479,6 +485,8 @@ def uc_special_open_if_cf(
479485
device_height=None,
480486
device_pixel_ratio=None,
481487
):
488+
if url and ":" not in url and "." in url:
489+
url = "https:" + url
482490
if url.startswith("http:") or url.startswith("https:"):
483491
special = False
484492
with suppress(Exception):
@@ -5938,6 +5946,8 @@ def get_local_driver(
59385946
'Emulation.setDeviceMetricsOverride',
59395947
set_device_metrics_override
59405948
)
5949+
else:
5950+
driver.get = lambda url: updated_get(driver, url)
59415951
return extend_driver(
59425952
driver, proxy_auth, use_uc, recorder_ext
59435953
)

0 commit comments

Comments
 (0)