summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-22 13:31:16 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-24 11:24:03 +0100
commitdd14fac826003eabd8e875a9877b840192f673e0 (patch)
tree10ea7207c2edd7596d4feb74a87c21699c5f69f5 /bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
parent7671fdcaf6a788d80dbe002573f8b7d7f39d13c8 (diff)
downloadpoky-dd14fac826003eabd8e875a9877b840192f673e0.tar.gz
bitbake: toaster/tests/browser/helper: Improve wait_until_clickable exception handling
Our own Wait() class allows exception handling which this form of wrapper does not. Switch the code to use our Wait() class to allow retrying upon encountering those exceptions (such as an element not being present yet). The displayed and visible test is what Selenium would be doing internally, there is no JS reprensetation of clickable directly. (Bitbake rev: 8266a01b750b3758badeee8fb3a1acfa72c17a93) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/selenium_helpers_base.py')
-rw-r--r--bitbake/lib/toaster/tests/browser/selenium_helpers_base.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
index 45eabaf1ce..82defea0f2 100644
--- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -234,17 +234,9 @@ class SeleniumTestCaseBase(unittest.TestCase):
234 234
235 def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT): 235 def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT):
236 """ Wait until element matching CSS selector is visible on the page """ 236 """ Wait until element matching CSS selector is visible on the page """
237 sel = selector 237 is_clickable = lambda driver: (self.find(selector).is_displayed() and self.find(selector).is_enabled())
238 if sel.startswith('#'): 238 msg = 'An element matching "%s" should be clickable' % selector
239 sel = selector[1:] 239 Wait(self.driver, timeout=timeout).until(is_clickable, msg)
240 WebDriverWait(
241 self.driver,
242 timeout=timeout,
243 ).until(
244 EC.element_to_be_clickable((By.ID, sel
245 )
246 )
247 )
248 return self.find(selector) 240 return self.find(selector)
249 241
250 def wait_until_focused(self, selector): 242 def wait_until_focused(self, selector):