Reputation: 1357
Long story short, I have a web application where i have a button which triggers 2 async ajax calls. The 2 ajax calls use a parameter which is actually a javascript variable set in the application. When the two ajax calls are done, a third ajax call is performed using the result from one of the initial ajax calls. This third ajax call, when done, adds a new div in the content.
So far I used CodeCeption with WebDriver, where the above functionality was easily simulated by two simple actions:
$I->click(button)
$I->waitForElementVisible(newdiv)
I am now trying to simulate the same using PhpBrowser but I'm not certain how to approach this:
1. Since PhpBrowser doesn't use javascript, how can I send the javascript param in the 2 ajax calls?
2. Since there is no waitforelement function available in PhpBrowser, do I need to manually trigger all 3 ajax calls? Or will PhpBrowser be able to manually execute the callback of the two ajax calls and automatically trigger the third one?
Upvotes: 3
Views: 1609
Reputation: 14110
PhpBrowser does not execute any javascript.
You have to hardcode or calculate a value of your "javascript variable" in your test's PHP code.
And use sendAjaxRequest methods: http://codeception.com/docs/modules/PhpBrowser#sendAjaxGetRequest
Upvotes: 6