Skip to content

Commit 7bd5d77

Browse files
committed
Set default selector to "html" for text-search methods (it's now optional too)
1 parent 493827a commit 7bd5d77

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def is_partial_link_text_visible(self, partial_link_text):
633633
return page_actions.is_element_visible(self.driver, partial_link_text,
634634
by=By.PARTIAL_LINK_TEXT)
635635

636-
def is_text_visible(self, text, selector, by=By.CSS_SELECTOR):
636+
def is_text_visible(self, text, selector="html", by=By.CSS_SELECTOR):
637637
self.wait_for_ready_state_complete()
638638
time.sleep(0.01)
639639
if page_utils.is_xpath_selector(selector):
@@ -1946,7 +1946,7 @@ def assert_element(self, selector, by=By.CSS_SELECTOR,
19461946
# with the exception of assert_*, which won't return the element,
19471947
# but like the others, will raise an exception if the call fails.
19481948

1949-
def wait_for_text_visible(self, text, selector, by=By.CSS_SELECTOR,
1949+
def wait_for_text_visible(self, text, selector="html", by=By.CSS_SELECTOR,
19501950
timeout=settings.LARGE_TIMEOUT):
19511951
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
19521952
timeout = self.__get_new_timeout(timeout)
@@ -1958,30 +1958,30 @@ def wait_for_text_visible(self, text, selector, by=By.CSS_SELECTOR,
19581958
return page_actions.wait_for_text_visible(
19591959
self.driver, text, selector, by, timeout)
19601960

1961-
def wait_for_text(self, text, selector, by=By.CSS_SELECTOR,
1961+
def wait_for_text(self, text, selector="html", by=By.CSS_SELECTOR,
19621962
timeout=settings.LARGE_TIMEOUT):
19631963
""" The shorter version of wait_for_text_visible() """
19641964
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
19651965
timeout = self.__get_new_timeout(timeout)
19661966
return self.wait_for_text_visible(
19671967
text, selector, by=by, timeout=timeout)
19681968

1969-
def find_text(self, text, selector, by=By.CSS_SELECTOR,
1969+
def find_text(self, text, selector="html", by=By.CSS_SELECTOR,
19701970
timeout=settings.LARGE_TIMEOUT):
19711971
""" Same as wait_for_text_visible() - returns the element """
19721972
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
19731973
timeout = self.__get_new_timeout(timeout)
19741974
return self.wait_for_text_visible(
19751975
text, selector, by=by, timeout=timeout)
19761976

1977-
def assert_text_visible(self, text, selector, by=By.CSS_SELECTOR,
1977+
def assert_text_visible(self, text, selector="html", by=By.CSS_SELECTOR,
19781978
timeout=settings.SMALL_TIMEOUT):
19791979
""" Same as assert_text() """
19801980
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
19811981
timeout = self.__get_new_timeout(timeout)
19821982
return self.assert_text(text, selector, by=by, timeout=timeout)
19831983

1984-
def assert_text(self, text, selector, by=By.CSS_SELECTOR,
1984+
def assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
19851985
timeout=settings.SMALL_TIMEOUT):
19861986
""" Similar to wait_for_text_visible()
19871987
Raises an exception if the element or the text is not found.
@@ -2378,7 +2378,7 @@ def check_assert_element(self, selector, by=By.CSS_SELECTOR,
23782378
""" DEPRECATED - Use self.delayed_assert_element() instead. """
23792379
return self.delayed_assert_element(selector, by=by, timeout=timeout)
23802380

2381-
def delayed_assert_text(self, text, selector, by=By.CSS_SELECTOR,
2381+
def delayed_assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
23822382
timeout=settings.MINI_TIMEOUT):
23832383
""" A non-terminating assertion for text from an element on a page.
23842384
Failures will be saved until the process_delayed_asserts()
@@ -2400,7 +2400,7 @@ def delayed_assert_text(self, text, selector, by=By.CSS_SELECTOR,
24002400
return False
24012401

24022402
@decorators.deprecated("Use self.delayed_assert_text() instead!")
2403-
def check_assert_text(self, text, selector, by=By.CSS_SELECTOR,
2403+
def check_assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
24042404
timeout=settings.MINI_TIMEOUT):
24052405
""" DEPRECATED - Use self.delayed_assert_text() instead. """
24062406
return self.delayed_assert_text(text, selector, by=by, timeout=timeout)

0 commit comments

Comments
 (0)