Switch to another window identified by name.
The window can only be identified by name. If the $name parameter is blank, the parent window will be used.
Example:
html
php
click("Open window");
# switch to another window
$I->switchToWindow("another_window");
# switch to parent window
$I->switchToWindow();
?>
If the window has no name, the only way to access it is via the executeInSelenium() method, like so:
php
executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
$handles=$webdriver->getWindowHandles();
$last_window = end($handles);
$webdriver->switchTo()->window($last_window);
});
?>
See also:
Codeception\Module\WebDriver::switchToWindow()