Selenium: Do different browser instances have separate cookie jars?

I am trying to test a scenario in which two separate users are logged in. As the question says, is this possible with Selenium? I do not use a browser, but I use Chrome.

+4
source share
2 answers

Selenium (web driver) allows you to open multiple browser windows (for example, 3 Firefox windows or 1 IE + 1 Firefox +1 Chrome).

In your code, you have an API to select the desired window (depending on how you opened it).

Regarding session processing: it depends on the type of browser. Firefox will share the session through multiple windows because it uses a single process. AFAIK IE and Chrome, if they are open as new processes, will not share it, but this, of course, also depends on how the server sets the cookie policy for the session. However, access to cookie values ​​in the browser depends on the domain, so persistent cookies or local storage can exchange information even through sessions, so it really depends on how the web application is implemented (or what infrastructure is used), which mainly takes care of such material).

+2
source

If you want complete separation, look at the selenium grid, https://code.google.com/p/selenium/wiki/Grid2

This will allow you to open browsers on different computers when you run the test on one computer.

+2
source

Source: https://habr.com/ru/post/1500048/


All Articles