Skip to content

Commit 63fea89

Browse files
committed
Improve select_option_by_*() methods
1 parent 42afc74 commit 63fea89

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,9 +1223,12 @@ def __select_option(self, dropdown_selector, option,
12231223
timeout = self.__get_new_timeout(timeout)
12241224
if page_utils.is_xpath_selector(dropdown_selector):
12251225
dropdown_by = By.XPATH
1226-
element = self.wait_for_element_visible(
1226+
self.wait_for_ready_state_complete()
1227+
element = self.wait_for_element_present(
12271228
dropdown_selector, by=dropdown_by, timeout=timeout)
1228-
self.__demo_mode_highlight_if_active(dropdown_selector, dropdown_by)
1229+
if self.is_element_visible(dropdown_selector, by=dropdown_by):
1230+
self.__demo_mode_highlight_if_active(
1231+
dropdown_selector, dropdown_by)
12291232
pre_action_url = self.driver.current_url
12301233
try:
12311234
if option_by == "index":
@@ -1237,7 +1240,7 @@ def __select_option(self, dropdown_selector, option,
12371240
except (StaleElementReferenceException, ENI_Exception):
12381241
self.wait_for_ready_state_complete()
12391242
time.sleep(0.05)
1240-
element = self.wait_for_element_visible(
1243+
element = self.wait_for_element_present(
12411244
dropdown_selector, by=dropdown_by, timeout=timeout)
12421245
if option_by == "index":
12431246
Select(element).select_by_index(option)

0 commit comments

Comments
 (0)