6 examples of 'selenium get attribute python' in Python

Every line of 'selenium get attribute python' 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
37def __getattribute__(self, name):
38 """
39 Pass ``__getattribute__`` directly to the first array element.
40 """
41 try:
42 attr = object.__getattribute__(self, 'elements')[0].__getattribute__(name)
43 except IndexError:
44 raise NoElementException(u'No elements found for selector: {0}'\
45 .format(object.__getattribute__(self, 'selector')))
46 return attr
1641def get_expression(self,expression):
1642 """
1643 Returns the specified expression.
1644
1645
1646 This is useful because of JavaScript preprocessing.
1647 It is used to generate commands like assertExpression and waitForExpression.
1648
1649
1650 'expression' is the value to return
1651 """
1652 return self.get_string("getExpression", [expression,])
201def attribute(self, name, ttl=None):
202 """Get the attribute with the given name
203
204 If there are multiple items in this object, the attribute of the first
205 element will be returned.
206
207 :param name: The name of the attribute
208 :param ttl: The minimum number of seconds to keep retrying
209 :returns: The attribute of the first element
210 """
211 def callback(elements):
212 return \
213 elements.item.get_attribute(name) if elements.items else None
214 return self.retried(callback, update=True, ttl=ttl)
177def __getattr__(self, name):
178 try:
179 out = self.__getattribute__(name)
180 except AttributeError:
181 out = getattr(self._browser, name)
182 return out
103def verifyAttribute(self, element, value):
104 """ Verify the value of an element attribute.
105 The syntax for returning an element attribute
106 is @attribute-name. """
107 return self.dispatchCommand("verifyAttribute", element, value)
192def get_element_attribute(self, element, attr, css=False, expected_value=None):
193 """
194 Get the value of an attribute or css attribute from an element.
195
196 :param element: CSS Selector or XPATH used to locate the element
197 :type element: str
198 :param attr: The attribute to lookup
199 :type attr: str
200 :param css: Whether or not this is a CSS atrribute
201 :type css: bool
202 :param expected_value:
203 :return: The value of the attribute
204 """
205 elem = self.get_element(element)
206 if css:
207 value = elem.value_of_css_property(attr)
208 if self.is_color(value):
209 value = Color.from_string(value)
210 if expected_value:
211 if self.is_color(expected_value):
212 expected_value = Color.from_string(expected_value)
213 return value, expected_value
214 else:
215 value = elem.get_attribute(attr)
216 return value

Related snippets