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)
| 998 | |
| 999 | |
| 1000 | def 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 | |
| 1029 | def uc_click( |
no test coverage detected
searching dependent graphs…