Always lowercase tagName
This commit is contained in:
parent
9bcce37ff3
commit
1c73751fd9
@ -139,7 +139,10 @@ class AbstractWebElement(collections.abc.MutableMapping):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def tag_name(self):
|
def tag_name(self):
|
||||||
"""Get the tag name of this element."""
|
"""Get the tag name of this element.
|
||||||
|
|
||||||
|
The returned name will always be lower-case.
|
||||||
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def outer_xml(self):
|
def outer_xml(self):
|
||||||
@ -299,7 +302,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
|
|||||||
roles = ('combobox', 'textbox')
|
roles = ('combobox', 'textbox')
|
||||||
log.misc.debug("Checking if element is editable: {}".format(
|
log.misc.debug("Checking if element is editable: {}".format(
|
||||||
repr(self)))
|
repr(self)))
|
||||||
tag = self.tag_name().lower()
|
tag = self.tag_name()
|
||||||
if self.is_content_editable() and self.is_writable():
|
if self.is_content_editable() and self.is_writable():
|
||||||
return True
|
return True
|
||||||
elif self.get('role', None) in roles and self.is_writable():
|
elif self.get('role', None) in roles and self.is_writable():
|
||||||
@ -321,7 +324,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
|
|||||||
def is_text_input(self):
|
def is_text_input(self):
|
||||||
"""Check if this element is some kind of text box."""
|
"""Check if this element is some kind of text box."""
|
||||||
roles = ('combobox', 'textbox')
|
roles = ('combobox', 'textbox')
|
||||||
tag = self.tag_name().lower()
|
tag = self.tag_name()
|
||||||
return self.get('role', None) in roles or tag in ['input', 'textarea']
|
return self.get('role', None) in roles or tag in ['input', 'textarea']
|
||||||
|
|
||||||
def remove_blank_target(self):
|
def remove_blank_target(self):
|
||||||
@ -330,7 +333,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
|
|||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
if elem is None:
|
if elem is None:
|
||||||
break
|
break
|
||||||
tag = elem.tag_name().lower()
|
tag = elem.tag_name()
|
||||||
if tag == 'a' or tag == 'area':
|
if tag == 'a' or tag == 'area':
|
||||||
if elem.get('target', None) == '_blank':
|
if elem.get('target', None) == '_blank':
|
||||||
elem['target'] = '_top'
|
elem['target'] = '_top'
|
||||||
|
@ -134,7 +134,7 @@ class WebKitElement(webelem.AbstractWebElement):
|
|||||||
def tag_name(self):
|
def tag_name(self):
|
||||||
"""Get the tag name for the current element."""
|
"""Get the tag name for the current element."""
|
||||||
self._check_vanished()
|
self._check_vanished()
|
||||||
return self._elem.tagName()
|
return self._elem.tagName().lower()
|
||||||
|
|
||||||
def outer_xml(self):
|
def outer_xml(self):
|
||||||
"""Get the full HTML representation of this element."""
|
"""Get the full HTML representation of this element."""
|
||||||
|
Loading…
Reference in New Issue
Block a user