切换到窗口时的Codeception未知错误

时间:2018-02-27 19:26:01

标签: php selenium selenium-webdriver codeception behat

一直在敲我的头,我只是想在弹出窗口中切换到谷歌登录。这些是我尝试过的解决方案:

解决方案1:

$I->switchToNextTab();

结果:

unknown error: $ is not defined

解决方案2:

$I->switchToWindow("name_of_other_window");

结果:

I'm still in the current window

解决方案3:

$this->I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
    $handles = $webdriver->getWindowHandles();
    $lastWindow = end($handles);
    $webdriver->switchTo()->window($lastWindow);
});

结果:

unknown error: $ is not defined

有谁知道如何解决此问题。

以下是一个例子,但这正是它的实施方式

enter image description here

0 个答案:

没有答案