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

Function uc_open_with_disconnect

seleniumbase/core/browser_launcher.py:1000–1026  ·  view source on GitHub ↗

Open a url and disconnect chromedriver. Then waits for the duration of the timeout. Note: You can't perform Selenium actions again until after you've called driver.connect().

(driver, url, timeout=None)

Source from the content-addressed store, hash-verified

998
999
1000def uc_open_with_disconnect(driver, url, timeout=None):
1001 """Open a url and disconnect chromedriver.
1002 Then waits for the duration of the timeout.
1003 Note: You can't perform Selenium actions again
1004 until after you've called driver.connect()."""
1005 url = shared_utils.fix_url_as_needed(url)
1006 if __is_cdp_swap_needed(driver):
1007 driver.cdp.get(url)
1008 time.sleep(0.3)
1009 return
1010 if not driver.is_connected():
1011 driver.connect()
1012 if (url.startswith("http:") or url.startswith("https:")):
1013 script = 'window.open("%s","_blank");' % url
1014 driver.execute_script(script)
1015 time.sleep(0.05)
1016 driver.close()
1017 driver.disconnect()
1018 min_timeout = 0.008
1019 if timeout and not str(timeout).replace(".", "", 1).isdigit():
1020 timeout = min_timeout
1021 if not timeout or timeout < min_timeout:
1022 timeout = min_timeout
1023 time.sleep(timeout)
1024 else:
1025 driver.default_get(url) # The original one
1026 return None
1027
1028
1029def uc_click(

Callers 1

get_local_driverFunction · 0.85

Calls 8

connectMethod · 0.80
closeMethod · 0.80
disconnectMethod · 0.80
__is_cdp_swap_neededFunction · 0.70
getMethod · 0.45
sleepMethod · 0.45
is_connectedMethod · 0.45
execute_scriptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…