From bf0719b8beb69099c07146ff2be307de333cec6c Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:20:07 -0500 Subject: [PATCH 1/3] Adding support for bringing your own driver to the Browser --- dash/testing/browser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dash/testing/browser.py b/dash/testing/browser.py index 1ce5eea68c..a38b061f17 100644 --- a/dash/testing/browser.py +++ b/dash/testing/browser.py @@ -41,6 +41,7 @@ class Browser(DashPageMixin): def __init__( self, browser, + driver=None, remote=False, remote_url=None, headless=False, @@ -65,8 +66,11 @@ def __init__( self._percy_run = percy_run self._pause = pause - self._driver = until(self.get_webdriver, timeout=1) - self._driver.implicitly_wait(2) + if driver: + self._driver = driver + else: + self._driver = until(self.get_webdriver, timeout=1) + self._driver.implicitly_wait(2) self._wd_wait = WebDriverWait(self.driver, wait_timeout) self._last_ts = 0 From d5d816b97058baeac09bf0bc2f82b9773dd6b4ce Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:44:56 -0500 Subject: [PATCH 2/3] moving driver to be last argument to avoid use in positional arguments --- dash/testing/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dash/testing/browser.py b/dash/testing/browser.py index a38b061f17..9eeaa50666 100644 --- a/dash/testing/browser.py +++ b/dash/testing/browser.py @@ -41,7 +41,6 @@ class Browser(DashPageMixin): def __init__( self, browser, - driver=None, remote=False, remote_url=None, headless=False, @@ -52,6 +51,7 @@ def __init__( percy_assets_root="", wait_timeout=10, pause=False, + driver=None, ): self._browser = browser.lower() self._remote_url = remote_url From e2a03809213d8bba975df608d8b272c312021c7a Mon Sep 17 00:00:00 2001 From: BSd3v <82055130+BSd3v@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:09:37 -0500 Subject: [PATCH 3/3] Making `implicitly_wait` the default for even with drivers --- dash/testing/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dash/testing/browser.py b/dash/testing/browser.py index 9eeaa50666..511451bfe8 100644 --- a/dash/testing/browser.py +++ b/dash/testing/browser.py @@ -70,7 +70,7 @@ def __init__( self._driver = driver else: self._driver = until(self.get_webdriver, timeout=1) - self._driver.implicitly_wait(2) + self._driver.implicitly_wait(2) self._wd_wait = WebDriverWait(self.driver, wait_timeout) self._last_ts = 0