Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法将switchToWindow与codeception一起使用_Php_Selenium_Codeception - Fatal编程技术网

Php 无法将switchToWindow与codeception一起使用

Php 无法将switchToWindow与codeception一起使用,php,selenium,codeception,Php,Selenium,Codeception,我在codeception上练习了函数switchToWindow。但这对我不起作用 任何人都可以帮我解决问题。我想切换到登录弹出窗口输入电子邮件/密码,但我不能。 ![在此处输入图像描述][1] 这是我的设想 在当前页面上,点击登录按钮=>将打开一个新窗口,供用户输入facebook的电子邮件/密码。单击提交按钮后,它将重定向到最后一个窗口页面A Here is my code $I=新的AcceptanceTester$方案; $I->amOnPage'/排行榜'; $I->点击“fb

我在codeception上练习了函数switchToWindow。但这对我不起作用

任何人都可以帮我解决问题。我想切换到登录弹出窗口输入电子邮件/密码,但我不能。 ![在此处输入图像描述][1] 这是我的设想 在当前页面上,点击登录按钮=>将打开一个新窗口,供用户输入facebook的电子邮件/密码。单击提交按钮后,它将重定向到最后一个窗口页面A

Here is my code 
$I=新的AcceptanceTester$方案; $I->amOnPage'/排行榜'; $I->点击“fb-login”; $I->executeInSeleniumfunction\Webdriver\Session$Webdriver{ $handles=$webdriver->window\u句柄; $last_window=end$句柄; $webdriver->focusWindow$last\u窗口; }; $I->fillField'email','aaa@yahoo.com'; $I->fillField“通行证”和“aaa”;
$I->单击“/*[@id=u_0_1]” 使用以下代码:

$I->executeInSelenium(function (Webdriver $webdriver) {
   $handles=$webdriver->getWindowHandles();
   $last_window = end($handles);
   $webdriver->switchTo()->window($last_window);
});
然后

$I->switchToWindow();
如果需要,要返回主窗口

请尝试此选项

$I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
             $handles=$webdriver->getWindowHandles(); 
             $first_window = ($handles[0]);      
             $last_window = ($handles[1]);
             $webdriver->switchTo()->window($last_window);      
        });