Behat + selenium 2 wait for page to load

我只是一个虾纸丫 提交于 2019-11-28 13:47:19

You can use a wait method with javasccript condition like:

/**
 * @When /^wait for the page to be loaded$/
 */
public function waitForThePageToBeLoaded()
{
    $this->getSession()->wait(10000, "document.readyState === 'complete'");
}

Another good practice is to have a method that waits for the element, if element is found returns the element object else it will throw an exception.

For the click method you can have something like this:

$this->waitForElement("css_selector")->click();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!