CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

How to switch to another window or tab.

Open ecampii opened this issue 10 years ago • 2 comments

I was thinking swtichTo can use to switch to windows not only on iframes.. is this possible?

ecampii avatar Jul 13 '16 03:07 ecampii

Actually not, you can control only one browser instance right now. As for tabs, I think you can do pressKey(['ctrl', 't']) to open another tab in browser and to work inside it.

In future versions we will add possibility to use several actors in tests.

DavertMik avatar Jul 27 '16 20:07 DavertMik

If you use WebdriverIO, use something like that

changeTab(num) {
        let client = this.helpers['WebDriverIO'].browser;
        return client
            .getTabIds(function (err, handles) {
                this.switchTab(handles[num - 1]);
                return;
            })
    }

APshenkin avatar Jul 29 '16 08:07 APshenkin