7 examples of 'ends with xpath in selenium' in Python

Every line of 'ends with xpath in selenium' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
105@property
106def _xpath_prefix(self):
107 return './/*'
73@s.xpath
74def xpath(locator):
75 input_button_expr = x.descendant("input")[
76 x.attr("type").one_of("submit", "reset", "image", "button")]
77 button_expr = x.descendant("button")
78 image_button_expr = x.descendant("input")[x.attr("type").equals("image")]
79
80 if locator:
81 attr_matchers = (
82 x.attr("id").equals(locator) |
83 x.attr("value").is_(locator) |
84 x.attr("title").is_(locator))
85 image_attr_matchers = x.attr("alt").is_(locator)
86
87 if capybara.enable_aria_label:
88 attr_matchers |= x.attr("aria-label").is_(locator)
89 image_attr_matchers |= x.attr("aria-label").is_(locator)
90
91 input_button_expr = input_button_expr[attr_matchers]
92 button_expr = button_expr[
93 attr_matchers |
94 x.string.n.is_(locator) |
95 x.descendant("img")[x.attr("alt").is_(locator)]]
96 image_button_expr = image_button_expr[image_attr_matchers]
97
98 return input_button_expr + button_expr + image_button_expr
395def xpath(self, target, eager=False, timeout=None):
396 return self.waitfor("xpath", target, eager, timeout)
13def xpath(haystack, query):
14 from lxml import etree
15 return etree.HTML(haystack).xpath(query)
68@staticmethod
69def xpath(xpath):
70 return With(_WithType.XPATH, xpath)
128def _xpath(el, xpath):
129 e = el.xpath(xpath)
130 if e:
131 return e[0]
132 return default_val
254def get_element_by_xpath(self, selector):
255 """
256 Gets an element using an xPath selector.
257 """
258 raise NotImplementedError(
259 "This browser doesn't support getting elements by xpath")

Related snippets