Skip to content

Commit f00bea0

Browse files
committed
Replace "expected_conditions" with alternatives
1 parent 9e940dc commit f00bea0

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7283,14 +7283,9 @@ def __is_shadow_element_visible(self, selector):
72837283
return False
72847284

72857285
def __is_shadow_element_clickable(self, selector):
7286-
from selenium.webdriver.support import expected_conditions as EC
7287-
from selenium.webdriver.support.ui import WebDriverWait
7288-
72897286
try:
72907287
element = self.__get_shadow_element(selector, timeout=0.1)
7291-
if element.is_displayed() and WebDriverWait(self.driver, 0).until(
7292-
EC.element_to_be_clickable(element)
7293-
):
7288+
if element.is_displayed() and element.is_enabled():
72947289
return True
72957290
return False
72967291
except Exception:

seleniumbase/fixtures/page_actions.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,9 @@ def is_element_clickable(driver, selector, by="css selector"):
8181
@Returns
8282
Boolean (is element clickable)
8383
"""
84-
from selenium.webdriver.support import expected_conditions as EC
85-
from selenium.webdriver.support.ui import WebDriverWait
86-
8784
try:
8885
element = driver.find_element(by=by, value=selector)
89-
if element.is_displayed() and WebDriverWait(driver, 0).until(
90-
EC.element_to_be_clickable(element)
91-
):
86+
if element.is_displayed() and element.is_enabled():
9287
return True
9388
return False
9489
except Exception:
@@ -775,9 +770,6 @@ def wait_for_element_clickable(
775770
@Returns
776771
A web element object
777772
"""
778-
from selenium.webdriver.support import expected_conditions as EC
779-
from selenium.webdriver.support.ui import WebDriverWait
780-
781773
element = None
782774
is_present = False
783775
is_visible = False
@@ -790,9 +782,7 @@ def wait_for_element_clickable(
790782
is_present = True
791783
if element.is_displayed():
792784
is_visible = True
793-
if WebDriverWait(driver, 0.001).until(
794-
EC.element_to_be_clickable((by, selector))
795-
):
785+
if element.is_enabled():
796786
return element
797787
else:
798788
element = None

0 commit comments

Comments
 (0)