Complete coverage for webelem
This commit is contained in:
parent
ef6ffd6a3a
commit
e90ad3d9c0
@ -288,7 +288,7 @@ class WebElementWrapper(collections.abc.MutableMapping):
|
|||||||
def remove_blank_target(self):
|
def remove_blank_target(self):
|
||||||
"""Remove target from link."""
|
"""Remove target from link."""
|
||||||
elem = self._elem
|
elem = self._elem
|
||||||
for i in range(5):
|
for _ in range(5):
|
||||||
if elem is None:
|
if elem is None:
|
||||||
break
|
break
|
||||||
tag = elem.tagName().lower()
|
tag = elem.tagName().lower()
|
||||||
|
@ -347,11 +347,16 @@ class TestWebElementWrapper:
|
|||||||
elem_child.remove_blank_target()
|
elem_child.remove_blank_target()
|
||||||
assert elem._elem.attribute('target') == '_top'
|
assert elem._elem.attribute('target') == '_top'
|
||||||
|
|
||||||
elem = get_webelem(tagname='button')
|
elem[0] = get_webelem(tagname='div')
|
||||||
elem_child = get_webelem(tagname='div', parent=elem._elem)
|
for i in range(1, 5):
|
||||||
elem_child._elem.encloseWith(elem._elem)
|
elem[i] = get_webelem(tagname='div', parent=elem[i-1])
|
||||||
elem_child.remove_blank_target()
|
elem[i]._elem.encloseWith(elem[i-1]._elem)
|
||||||
assert 'target' not in elem_child
|
elem[4].remove_blank_target()
|
||||||
|
for i in range(5):
|
||||||
|
assert 'target' not in elem[i]
|
||||||
|
|
||||||
|
elem = get_webelem(tagname='div')
|
||||||
|
elem.remove_blank_target()
|
||||||
assert 'target' not in elem
|
assert 'target' not in elem
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user