Skip to content

Commit 86763c6

Browse files
committed
Refactor base_case.py
1 parent 0c9769a commit 86763c6

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,6 +2943,20 @@ def click_link(self, link_text, timeout=None):
29432943
timeout = self.__get_new_timeout(timeout)
29442944
self.click_link_text(link_text, timeout=timeout)
29452945

2946+
def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
2947+
timeout=None):
2948+
""" Same as self.wait_for_element() """
2949+
if not timeout:
2950+
timeout = settings.LARGE_TIMEOUT
2951+
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
2952+
timeout = self.__get_new_timeout(timeout)
2953+
selector, by = self.__recalculate_selector(selector, by)
2954+
return page_actions.wait_for_element_visible(
2955+
self.driver, selector, by, timeout)
2956+
2957+
def print(self, *args, **kwargs):
2958+
print(*args, **kwargs)
2959+
29462960
def start_tour(self, name=None, interval=0):
29472961
self.play_tour(name=name, interval=interval)
29482962

@@ -3559,8 +3573,7 @@ def wait_for_element_present(self, selector, by=By.CSS_SELECTOR,
35593573
return page_actions.wait_for_element_present(
35603574
self.driver, selector, by, timeout)
35613575

3562-
def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
3563-
timeout=None):
3576+
def wait_for_element(self, selector, by=By.CSS_SELECTOR, timeout=None):
35643577
""" Waits for an element to appear in the HTML of a page.
35653578
The element must be visible (it cannot be hidden). """
35663579
if not timeout:
@@ -3571,14 +3584,6 @@ def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
35713584
return page_actions.wait_for_element_visible(
35723585
self.driver, selector, by, timeout)
35733586

3574-
def wait_for_element(self, selector, by=By.CSS_SELECTOR, timeout=None):
3575-
""" The shorter version of wait_for_element_visible() """
3576-
if not timeout:
3577-
timeout = settings.LARGE_TIMEOUT
3578-
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
3579-
timeout = self.__get_new_timeout(timeout)
3580-
return self.wait_for_element_visible(selector, by=by, timeout=timeout)
3581-
35823587
def get_element(self, selector, by=By.CSS_SELECTOR, timeout=None):
35833588
""" Same as wait_for_element_present() - returns the element.
35843589
The element does not need be visible (it may be hidden). """

0 commit comments

Comments
 (0)