webengine: Use _click_href for hinting target=_blank links

Fixes #2311
This commit is contained in:
Florian Bruhin 2017-02-17 06:57:31 +01:00
parent 40e1337e03
commit ba21fb3784
2 changed files with 6 additions and 2 deletions

View File

@ -403,7 +403,12 @@ class AbstractWebElement(collections.abc.MutableMapping):
href_tags = ['a', 'area', 'link'] href_tags = ['a', 'area', 'link']
if click_target == usertypes.ClickTarget.normal: if click_target == usertypes.ClickTarget.normal:
if self.tag_name() in href_tags and self.get('target') != '_blank': if self.tag_name() in href_tags and self.get('target') == '_blank':
log.webelem.debug("target _blank -> Clicking via href")
# FIXME:qtwebengine Should we use tab_bg here with
# background-tabs set?
self._click_href(usertypes.ClickTarget.tab)
elif self.tag_name() in href_tags:
log.webelem.debug("Clicking via JS click()") log.webelem.debug("Clicking via JS click()")
self._click_js(click_target) self._click_js(click_target)
elif self.is_editable(strict=True): elif self.is_editable(strict=True):

View File

@ -18,7 +18,6 @@ Feature: Using hints
Then the following tabs should be open: Then the following tabs should be open:
- data/hello.txt (active) - data/hello.txt (active)
@qtwebengine_skip: Opens in background
Scenario: Following a hint and allow to open in new tab. Scenario: Following a hint and allow to open in new tab.
When I open data/hints/link_blank.html When I open data/hints/link_blank.html
And I hint with args "links normal" and follow a And I hint with args "links normal" and follow a