Handle frames

This commit is contained in:
Kevin Velghe 2016-03-30 19:08:10 +02:00
parent 201739a7e6
commit 571d6519e9
2 changed files with 7 additions and 6 deletions

View File

@ -466,7 +466,7 @@ class HintManager(QObject):
Qt.NoButton, modifiers),
]
if context.target == Target.current:
elem.remove_target()
elem.remove_blank_target()
for evt in events:
self.mouse_event.emit(evt)
if elem.is_text_input() and elem.is_editable():

View File

@ -285,12 +285,13 @@ class WebElementWrapper(collections.abc.MutableMapping):
tag = self._elem.tagName().lower()
return self.get('role', None) in roles or tag in ('input', 'textarea')
def remove_target(self):
def remove_blank_target(self):
"""Remove target from link."""
if self._elem.tagName().lower() == 'a':
self._elem.removeAttribute('target')
elif self.parent().tagName().lower() == 'a':
self.parent().removeAttribute('target')
for elem in [self._elem, self.parent()]:
if elem.tagName().lower() == 'a':
if elem.attribute('target') == '_blank':
elem.setAttribute('target', '_top')
break
def debug_text(self):
"""Get a text based on an element suitable for debug output."""