GeckoDriver and InternetExplorerDriver always open new window instead of a new tab when I click link, ChromeDriver behaves normally

491 views Asked by At

ChromeDriver works as expected, when the driver clicks a link that should open a new tab it opens the new tab. This is different with GeckoDriver and InternetExplorerDriver, they always open new window, regardless that when I click these links by myself the new tab is opened as expected.

This is how I click links:

Driver.FindElement(selector).Click();

How to make FF and IE make open new tab when link is clicked when in automated mode? In other words make them behave the same as when I manually click these links.

1

There are 1 answers

9
Guy On

You can set the default behavior via FirefoxOptions

FirefoxOptions options = new FirefoxOptions();
options.SetPreference("browser.link.open_newwindow", 1);

WebDriver webDriver = new FirefoxDriver(options);