4

Is there any way I can change selenium firefox settings, so whenever i click a button on website that links to another website for example, that link opens in new tab, not new window?

I tried making custom profile, but it never worked for me.. always loads with anonymous one.

Any help is well appreciated.

Miqro
  • 467
  • 1
  • 8
  • 14
  • possible duplicate of [Open new tab in Firefox using Selenium WebDriver on Mac](http://stackoverflow.com/questions/21779470/open-new-tab-in-firefox-using-selenium-webdriver-on-mac) – James Mills Jun 24 '15 at 10:12
  • Correction; **exact** duplicate :) – James Mills Jun 24 '15 at 10:23
  • Sorry, I am not looking to paste my links into tabs, i click on button which then opens link in new window, and i want that window to be opened as tab.. – Miqro Jun 24 '15 at 10:58
  • Can't you hold ``CTRL`` key while you "click" the button/link? – James Mills Jun 24 '15 at 11:07
  • Nothing realy happens if i hold CTRL . I mean its the same as if I tried without CTRL. – Miqro Jun 24 '15 at 13:23

1 Answers1

3

You will have to send it via Browser action chaining only as selenium opens an anonymous session everytime. So, send click command like this.

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

ActionChains(driver).send_keys(Keys.COMMAND, "t").perform()
Anshul Joshi
  • 353
  • 3
  • 9
  • 1
    I know about this already, but i cannot get direct link.. I can only click on button which then opens new window, and i want that window to be in tab.. – Miqro Jun 24 '15 at 10:57