Skip to content
Discussion options

You must be logged in to vote

There's the long way if you're starting from the CDP WebElement:

def is_element_visible(self, selector):
selector = self.__convert_to_css_if_xpath(selector)
element = None
if ":contains(" not in selector:
try:
element = self.select(selector, timeout=0.01)
except Exception:
return False
if not element:
return False
try:
position = element.get_position()
return (position.width != 0 or position.height != 0)
except Exception:
return False
else:
with suppress(Exception):
tag_name = selector.split(":contains(")[0].split(" ")[-1]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants