5

I have the problem that switchTo doesn't "focus" the tab in question. I receive the array of present tabs with getAllWindowHandles and protractor is directing the actions to the right tab, but it never pops into foreground. Therefore elements never get visible. Am I doing something wrong here? (protractor 2.0.0, current Chrome)

var tabs;

function switchToUser1() {
    return browser.switchTo().window(tabs[0]);
}

function switchToUser2() {
    return browser.switchTo().window(tabs[1]);
}

beforeAll(function() {
    browser.executeScript("window.open('about:blank');");
    browser.getAllWindowHandles().then(function(handles) {
        tabs = handles;
    });
    switchToUser1();
    userPO.login(login1);
    switchToUser2();
    userPO.login(login2);
});
Aaron
  • 2,367
  • 3
  • 25
  • 33
roemer
  • 537
  • 1
  • 5
  • 21
  • I had an issue similar to this as well if you want to take a look: http://stackoverflow.com/questions/29502255/is-there-a-way-to-close-a-tab-in-webdriver-or-protractor – Aaron Apr 15 '15 at 16:54
  • 1
    I've already taken a look at that question. My problem is not to open the new tab. Also the new tab immediately has focus. My problem is that I can't switch between them. – roemer Apr 16 '15 at 04:43
  • 2
    The problem still exists, but I found a way that the tests are running. As you can see in my question, I open the tab at the very beginning. Even before page loading. Now I login with the first user, then open a tab and login with the second user there. After that I can execute tests in both tabs even if it is in the background. – roemer Apr 16 '15 at 07:15

0 Answers0