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

Method is_attribute_present

seleniumbase/core/sb_cdp.py:1893–1907  ·  view source on GitHub ↗
(self, selector, attribute, value=None)

Source from the content-addressed store, hash-verified

1891 self.loop.run_until_complete(self.page.evaluate(js_code))
1892
1893 def is_attribute_present(self, selector, attribute, value=None):
1894 try:
1895 element = self.find_element(selector, timeout=0.1)
1896 found_value = element.get_attribute(attribute)
1897 if found_value is None:
1898 return False
1899 if value is not None:
1900 if found_value == value:
1901 return True
1902 else:
1903 return False
1904 else:
1905 return True
1906 except Exception:
1907 return False
1908
1909 def is_online(self):
1910 js_code = "navigator.onLine;"

Callers

nothing calls this directly

Calls 2

find_elementMethod · 0.95
get_attributeMethod · 0.45

Tested by

no test coverage detected