Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium - Open firefox links in new tabs not new window? Python

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.

like image 551
Miqro Avatar asked Sep 02 '25 16:09

Miqro


1 Answers

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()