Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

browser1 and browser2 webdriver instances #574

Closed
elgalu opened this issue Mar 4, 2014 · 5 comments
Closed

browser1 and browser2 webdriver instances #574

elgalu opened this issue Mar 4, 2014 · 5 comments

Comments

@elgalu
Copy link
Contributor

elgalu commented Mar 4, 2014

Is it possible to have 2 browser instances running to test interactions between 2 users using an angular app?

I need this to test instant messaging and notifications between two logged in users.

By default browser would point to browser1 and all expectations would run by default on browser1 unless browser2 is specified with some DSL like:

it('works with 2 logged in users', function() {
  browser1.get('page1');
  browser2.get('page2');
  expect($('.div').getText()).toContain('hi'); // always defaults to browser1
  browser2.run(function() {
    $('button#send').click();
    expect($('.div').getText()).toContain('hello you');
  });
});
@Droogans
Copy link

Droogans commented Mar 4, 2014

Firefox allows you to getWindowHandles, which will behave in this way for you as long as you have an app that opens a new window/tab when you click it (a la target = _blank).

You may need to dig into the actual driver itself to figure out more.

@elgalu
Copy link
Contributor Author

elgalu commented Mar 4, 2014

This isn't exactly about windows handles @Droogans , i need each browser to keep separate cookies, i.e. individual selenium sessions. Can't have 2 different users logged in in the same browser session.

@Droogans
Copy link

Droogans commented Mar 4, 2014

Each window handle should contain its own set of cookies.

If you want to make this work, it will take some effort, and may also require that you set up your application to support this kind of a test.

I would recommend:

  1. That you not do this, as it's not an easy test to automate, and will likely be brittle. The return on investment for these kinds of tests are low, and may be best to do manually duing UAT.

If that's not possible:

  1. Open a new window.
  2. Carefully juggle the windows as you type messages and check them in both sessions.

I'm not sure protractor is going to provide you any resources for dealing with this issue, but I could be wrong.

@elgalu
Copy link
Contributor Author

elgalu commented Mar 4, 2014

I've used windows popup handles extensively already, even troubleshooted IE issues regarding the order in which they give you the handles back. Thanks for the link anyway.

But again, windows handles doesn't solve this, each window doesn't isolate cookies, is the same as opening a new window or tab in your browser right now.

@juliemr
Copy link
Member

juliemr commented Mar 4, 2014

This is a duplicate of #381 - closing as dupe, but please continue the discussion there!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants