1

I'm trying to open 2 different tabs in the same browser session from 2 different application.
I'm using Firefox v57.0, Geckodriver v0.19.1, Selenium v3.8.0.0

The 2 apps are playing in the same time.
I'm just trying to open a new tab from app 2 X seconds after App 1 open the first tab.

App 1:

FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.Port = 4444;

FirefoxOptions ffoptions = new FirefoxOptions();
ffoptions.SetLoggingPreference(LogType.Browser.ToString(), LogLevel.All);
ffoptions.SetPreference("marionette", true);
ffoptions.LogLevel = FirefoxDriverLogLevel.Trace;

FirefoxDriver driver = new FirefoxDriver(service, ffoptions, TimeSpan.FromSeconds(30));
driver.Navigate().GoToUrl("https://www.bing.com/");

App 2:

DesiredCapabilities capabilities = DesiredCapabilities.Firefox();
RemoteWebDriver driverReUse = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/"), capabilities);
driverReUse.Navigate().GoToUrl("https://www.google.com/");

The exception:

"Session is already started"

Isn't it possible to do that? Should I try to connect from App 2 to localhost with 4444?

John Daves
  • 47
  • 7
  • Possible duplicate of [How can I reconnect to the browser opened by webdriver with selenium?](https://stackoverflow.com/questions/47861813/how-can-i-reconnect-to-the-browser-opened-by-webdriver-with-selenium) – undetected Selenium Jan 09 '18 at 15:52
  • Nope. Im using c# and not python. and Im not quiting the script. In my situation the 2 apps are opening in the same time. Im just want to open new tab in the same browser and not re-connect to old browser after I quit. – John Daves Jan 09 '18 at 16:13
  • Why not just open the second tab from the first script? It's likely to work better in that the two scripts will be more in sync than if run separately. – JeffC Jan 09 '18 at 20:00
  • Yes you right. It's much easier from the same script. but I need to do that from 2 apps. – John Daves Jan 10 '18 at 06:50

0 Answers0