Issue
/**
* @param int $timeout : timeout period
* @throws ModuleException
*/
public function waitAjaxLoad($timeout = 10)
{
$this->webDriverModule->waitForJS('return !!window.jQuery && window.jQuery.active == 0;', $timeout);
$this->webDriverModule->wait(1);
$this->dontSeeJsError();
}
/**
* @param int $timeout : timeout period
* @throws ModuleException
*/
public function waitPageLoad($timeout = 10)
{
$this->webDriverModule->waitForJs('return document.readyState == "complete"', $timeout);
$this->waitAjaxLoad($timeout);
$this->dontSeeJsError();
}
These two functions did not work for me. Are there any workaround to wait until the redirected page is loaded?
Solution
Before invoking these methods,
/**
* @param int $timeout : timeout period
* @throws ModuleException
*/
public function waitAjaxLoad($timeout = 10)
{
$this->webDriverModule->waitForJS('return !!window.jQuery && window.jQuery.active == 0;', $timeout);
$this->webDriverModule->wait(1);
$this->dontSeeJsError();
}
/**
* @param int $timeout : timeout period
* @throws ModuleException
*/
public function waitPageLoad($timeout = 10)
{
$this->webDriverModule->waitForJs('return document.readyState == "complete"', $timeout);
$this->waitAjaxLoad($timeout);
$this->dontSeeJsError();
}
I had to invoke $this->switchToNextTab(1);
to move to the next tab in the browser.
Once your test case clicks on the submit button and it routes to a different page with a new browser tab, then you have to switchToNextTab by invoking $this->switchToNextTab(1);
.
After moving to the next-tab you can wait for the new page is to be loaded.
Answered By - Senal Weerasinghe
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.