diff mbox series

tests/browser: Avoid python 3.9 syntax

Message ID 20241011153957.814078-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series tests/browser: Avoid python 3.9 syntax | expand

Commit Message

Richard Purdie Oct. 11, 2024, 3:39 p.m. UTC
Python 3.9 isn't our minimum version yet, avoid using removeprefix.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/toaster/tests/browser/selenium_helpers_base.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py
index cc746511c3..7efc9ed34a 100644
--- a/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -231,12 +231,15 @@  class SeleniumTestCaseBase(unittest.TestCase):
 
     def wait_until_clickable(self, selector, poll=1):
         """ Wait until element matching CSS selector is visible on the page """
+        sel = selector
+        if sel.startswith('#'):
+            sel = selector[1:]
         WebDriverWait(
             self.driver,
             Wait._TIMEOUT,
             poll_frequency=poll
         ).until(
-            EC.element_to_be_clickable((By.ID, selector.removeprefix('#')
+            EC.element_to_be_clickable((By.ID, sel
                                         )
                                        )
         )