Adjust WebEngineEleement _js_dict in remove_blank_target

Otherwise, when checking later if the element has target=_blank set, we still
think it is.

This is not perfect as remove_blank_target also removes it from sub-elements,
but it's a good start.
This commit is contained in:
Florian Bruhin 2017-02-17 06:56:12 +01:00
parent 3de2bfb277
commit 40e1337e03

View File

@ -147,6 +147,8 @@ class WebEngineElement(webelem.AbstractWebElement):
return QRect()
def remove_blank_target(self):
if self._js_dict['attributes'].get('target') == '_blank':
self._js_dict['attributes']['target'] = '_top'
js_code = javascript.assemble('webelem', 'remove_blank_target',
self._id)
self._tab.run_js_async(js_code)