0

I will try and define the problem with a scenario, rather than try to explain it in detail, because I'm not knowledgeable about it (obviously).

I'm building a selenium application and I'm trying to use multiple webdriver instances to speed up it's work. The task is relied upon being logged in on a website.

The problem is, the website being used, is the type of website where if you are logged into a #1 session and try to start a #2 session by logging in from a different device (or webdriver instance in my case) it logs you out of the #1 session. Logging in ofcourse being inputting a username and a password.

I think that it's a simple problem to explain, I just don't know the terminology behind it.

Basically you can use multiple tabs of the same site and be logged in, as long as you aren't doing that outside of the browser instance.

The analogy is definitely off, but I think you get the point.

I want my webdriver instances to be able to share the whatever data there is required, so they act like a single browsing session.

I tried just using the selenium web driver built in window handles, but I'm not happy with the way it works. So new tabs within a single webdriver are definitely not a solution.

I also tried going trough the ChromeOptions library, but I definitely don't understand a thing in there, and to be honest, didn't even know what I was looking for.

Not much else except that. I haven't been able to boil the problem down to a simple question, so I don't know how and what to search for further solutions :)

  • Does this answer your question? [Open a new tab in an existing browser session using Selenium](https://stackoverflow.com/questions/41587533/open-a-new-tab-in-an-existing-browser-session-using-selenium) – Greg Burghardt Nov 09 '22 at 16:18
  • I'm wondering if you can get Selenium to open multiple tabs, then you wouldn't need multiple browser instances. The challenge is then interacting with the tabs individually. Maybe you could perform an action, switch tabs, perform another action, and by the time you loop back to tab 1 you can interact with the page? – Greg Burghardt Nov 09 '22 at 16:20

1 Answers1

0

The "data" I was trying to describe are cookies, and there are functions for getting cookies from a driver instance and for adding cookies to another.

driver.Manage.AllCookies()
driver.Manage.AddCookie()

Pretty self-explanatory :)

Hope this helps someone someday

Mustafa Poya
  • 2,615
  • 5
  • 22
  • 36