MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / get_property

Method get_property

seleniumbase/fixtures/base_case.py:2130–2161  ·  view source on GitHub ↗

Returns the property value of an element. This is not the same as self.get_property_value(), which returns the value of an element's computed style using a different algorithm. If no result is found, an empty string (instead of None) is returned. Example:

(
        self, selector, property, by="css selector", timeout=None
    )

Source from the content-addressed store, hash-verified

2128 return element.find_element(by="xpath", value="..")
2129
2130 def get_property(
2131 self, selector, property, by="css selector", timeout=None
2132 ):
2133 """Returns the property value of an element.
2134 This is not the same as self.get_property_value(), which returns
2135 the value of an element's computed style using a different algorithm.
2136 If no result is found, an empty string (instead of None) is returned.
2137 Example:
2138 html_text = self.get_property(SELECTOR, "textContent") """
2139 self.__check_scope()
2140 if not timeout:
2141 timeout = settings.LARGE_TIMEOUT
2142 if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
2143 timeout = self.__get_new_timeout(timeout)
2144 selector, by = self.__recalculate_selector(selector, by)
2145 self.wait_for_ready_state_complete()
2146 time.sleep(0.01)
2147 element = page_actions.wait_for_element_present(
2148 self.driver, selector, by, timeout
2149 )
2150 try:
2151 property_value = element.get_property(property)
2152 except (Stale_Exception, ENI_Exception, TimeoutException):
2153 self.wait_for_ready_state_complete()
2154 time.sleep(0.14)
2155 element = page_actions.wait_for_element_present(
2156 self.driver, selector, by, timeout
2157 )
2158 property_value = element.get_property(property)
2159 if not property_value:
2160 return ""
2161 return property_value
2162
2163 def get_text_content(
2164 self, selector="body", by="css selector", timeout=None

Callers 9

get_text_contentMethod · 0.95
get_textMethod · 0.80
is_text_visibleFunction · 0.80
is_exact_text_visibleFunction · 0.80
wait_for_text_visibleFunction · 0.80
get_textFunction · 0.80

Calls 6

__check_scopeMethod · 0.95
__get_new_timeoutMethod · 0.95
sleepMethod · 0.45

Tested by

no test coverage detected