4

I have an issue with my automation (selenium-webdriver). Every time I click on a link, that link would open in a new tab ‒ this is not expected, and links do not have _blank attr. set to them. My automation fails cause it stays on the first tab.

  • I've tried setting up a new automation env on a new PC - same result.
  • I've tried releasing Ctrl key using :controlKeyUp - same result

This issue happened during bug-fixes merge from v1 to v2 of my product.

P.S. on a version with older code automation works fine with no issues.

P.P.S. This issue is not reproducible manually.

Thanks!

Update: this is the HTML code:

<a href="SignIn" id="aSignIn" class="signin-link desktop-show" title="Sign in">Sign in</a>

And this is the test code:

driver.find_element(:id, "aSignIn").click
  • 1
    What browser do you use ? Do you check the options of your browser ? Some of them got an option to always open link in new tab. – Fabrice31 Feb 25 '15 at 21:42
  • All browsers new and older versions. I should have mentioned it does not happen when I click on a link manually. – Anton Feb 25 '15 at 22:53
  • @Anton - please share your web driver code with question. – Helping Hands Feb 26 '15 at 4:10
  • driver.find_element(:id, "aSignIn").click – Anton Feb 26 '15 at 16:59
  • <a href="SignIn" id="aSignIn" class="signin-link desktop-show" title="Sign in">Sign in</a> – Anton Feb 26 '15 at 17:00
1

0 down vote unaccept

I will explain how we dealt with the issue.

We've implemented Google Analytics event tracking on our site, so it would check every link to see if it is an external one. A reg-ex for that was written to check links, but it did not incorporate the way I was bypassing basic authentication "http://LOGIN:PASSWORD@yoursite.com". Therefore GA thought every link was an external one and GA injected its .js with "_blank" attribute.

Not the answer you're looking for? Browse other questions tagged or ask your own question.