MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / assert_link_text

Method assert_link_text

seleniumbase/fixtures/base_case.py:11078–11107  ·  view source on GitHub ↗

Similar to wait_for_link_text_visible(), but returns nothing. As above, raises an exception if nothing can be found. Returns True if successful. Default timeout = SMALL_TIMEOUT.

(self, link_text, timeout=None)

Source from the content-addressed store, hash-verified

11076 return self.wait_for_link_text_visible(link_text, timeout=timeout)
11077
11078 def assert_link_text(self, link_text, timeout=None):
11079 """Similar to wait_for_link_text_visible(), but returns nothing.
11080 As above, raises an exception if nothing can be found.
11081 Returns True if successful. Default timeout = SMALL_TIMEOUT."""
11082 self.__check_scope()
11083 if not timeout:
11084 timeout = settings.SMALL_TIMEOUT
11085 if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
11086 timeout = self.__get_new_timeout(timeout)
11087 if self.__is_cdp_swap_needed():
11088 self.cdp.find_element(link_text, timeout=timeout)
11089 return
11090 self.wait_for_link_text_visible(link_text, timeout=timeout)
11091 if self.demo_mode:
11092 a_t = "ASSERT LINK TEXT"
11093 if self._language != "English":
11094 from seleniumbase.fixtures.words import SD
11095
11096 a_t = SD.translate_assert_link_text(self._language)
11097 messenger_post = "<b>%s</b>: {%s}" % (a_t, link_text)
11098 self.__highlight_with_assert_success(
11099 messenger_post, link_text, by="link text"
11100 )
11101 if self.recorder_mode and self.__current_url_is_recordable():
11102 if self.get_session_storage_item("pause_recorder") == "no":
11103 time_stamp = self.execute_script("return Date.now();")
11104 origin = self.get_origin()
11105 action = ["as_lt", link_text, origin, time_stamp]
11106 self.__extra_actions.append(action)
11107 return True
11108
11109 def wait_for_partial_link_text(self, partial_link_text, timeout=None):
11110 self.__check_scope()

Calls 11

__check_scopeMethod · 0.95
__get_new_timeoutMethod · 0.95
__is_cdp_swap_neededMethod · 0.95
execute_scriptMethod · 0.95
get_originMethod · 0.95
find_elementMethod · 0.45

Tested by 4

test_demo_siteMethod · 0.64
test_get_coffeeMethod · 0.64
test_demo_siteMethod · 0.64
test_demo_pageMethod · 0.64