5

我正在尝试测试两个不同用户登录的场景。正如问题所述,这对 Selenium 可行吗?如果它依赖于浏览器,我不知道,但我使用的是 Chrome。

4

2 回答 2

3

Selenium (web driver) allows to open several browser windows (e.g. 3 Firefox windows or 1 IE + 1 Firefox +1 Chrome).

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

Regarding the session handling: that depends on the browser type. Firefox will share the session across multiple windows because it's using a single process. AFAIK IE and Chrome if opened as new processes will not share it, but this of course depends also on how the server is setting the cookie policy for the session. Access to cookie values in the browser however is domain dependent, so a persistent cookies or local storage can share information even across sessions, so it really depends on how the web application is implemented (or what framework is using - that mostly takes care of such stuff).

于 2013-09-01T19:17:01.260 回答
2

如果你想要完全分离,那么看看 Selenium Grid;https://code.google.com/p/selenium/wiki/Grid2

这将允许您在一台机器上运行测试时在不同的计算机上打开浏览器

于 2013-09-01T21:09:53.950 回答