t.switchToParentWindow method

Activates the window that launched or was active when the active window was launched. Can be chained with other TestController methods.

t.switchToParentWindow() → this | Promise<any>

Example:

import { Selector, ClientFunction } from 'testcafe';

fixture `Example page`
    .page('http://www.example.com/');

test('Switch to the parent window', async t => {
    await t
        .openWindow('https://devexpress.com')
        .switchToParentWindow();

    const url = await t.eval(() => document.documentURI);
    await t.expect(url).eql('http://example.com/');
});