when i'm using selenium rc i used waitForPageToLoad method but in WebDriver i'm unable to find method for wait. is there any way to achieve this? i know webDriver allows wait For page Load implicitly but it's not working for me. thanks in advance.
WebDriver shouldn't return until the page has loaded, but if this is not working for you e.g. your pages is using AJAX, then you could add your own wait code using wait.until from org.openqa.selenium.support.ui.WebDriverWait.
There's a full example at http://www.qaautomation.net/?p=263
Related
Although I use waitFor() in my UI test properly in the Karate framework, it does not work for mobile test. I think there is an issue with Appium or the emulator.I also tried with real devices but still no solution. How my test can wait until the URL is ready to accept HTTP connections by using the Karate framework?
Thanks in advance!
As of karate 1.0.1 wait functions are predominantly designed for the web. we've added the support for waitFor in mobile and it should be available in the next release,
waitFor(locator)
It would be more helpful if you follow the instructions Devloper Guide and confirm if this works.
I try to run a selenium test (using selenium IDE on Firefox) For an angular app.
I followed the instructions here in SO and added something like this:
Command=waitForElementPresent
Target=//h3
But even if there are a lot of H3s generated quite quickly by the app, Selenium does not seem to be able to find any them. (it keeps waiting on the WaitForElementPresent command)
Anything else I have to do to make this work?
I would highly recommend you to use protractor in addition to Selenium. Basically its a Javascript executor which can locate elements by ng tags. I tried to test an angular site with selenium only, but protractor really made my life easier!
If there are are many H3 tags in your application , it would be a good idea to give an unique Id to tags .
like :
<h3 id="someUniqueId"> heading </h3>
which can be accessed by :
Command=waitForElementPresent
Target=id=someUniqueId
If you don't want to make the entire switch to Protractor but you do want to wait for Angular I recommend using Paul Hammants ngWebDriver (Java).
For me the standard selenium implicit wait didn't work as our page is built asyncronously with Angular. I fixed this by writing an actions class in which I waited for Angular (using ngWebDriver's waitForAngularRequestsToFinish()) before carrying out the actions (click, fill, check etc.).
i would like to use Behat for testing my angular.js application. But the problem i'm experiencing is that when you go to a route and want to click on a link Behat doesn't know when the template is rendered, so sometimes it clicks while the content isn't available. Anyone that has experience with testing an angular.js application using Behat?
Or does anyone know how you can check in javascript if the template of the current route is done rendering? And how to check if angular.js is done bootstrapping the application on page load?
I know angular.js has ngScenario, but i want to use Behat because:
The Gherkin language which is human readable
Our backend is written in Symfony, so we can use the same framework for testing both
kind regards,
Daan
The mink api has a method wait which allows you to pause the execution of your PHP contexts until your javascript application has finished processing 'something'. There's a simple example in the docs: http://mink.behat.org/#basic-browser-interaction
$session->wait(5000,
"$('.suggestions-results').children().length > 0"
);
In the example provided, the PHP context will be paused for up to 5 seconds until the list of suggestion results has been populated. You'll need to ascertain the equivalent javascript expression which will ascertain when your route has finished rendering.
We've had some trouble in the past using jQuery expressions and have reverted back to native browser methods such as getElementById.
You'll also need to use a mink driver capable of executing javascript. We use the ZombieDriver as it runs on the command line. There are a few alternatives which may suit you better.
http://mink.behat.org/#different-browsers-drivers
I am using selenium to automate ExtJs(Ver 3) web application. My main challenge is, Wait for page(Elements) to be rendered. is there any build in function with Extjs or any javascript functions to verify the page is completely rendered. Currently i am managing with thread.sleep. But it sucks lots of execution time. I need a dynamic wait handler. Can any one help me
Using javascript we can make it. Here are two methods:
one is : document.readyState
another one is : document.body.readyState
I am working in selenium to test the ExtJs application. My problem is, I need to ensure the page is completely rendered. I cant use selenium.waitForPageLoad. In normal Ajax application i can use "Ajax.activeRequestCount", which will give the Ajax call count. If it is '0' We can ensure the page is completly loaded. Is there any similar function available in ExtJs? Can any one pls help me on this
There is no such method in ExtJs. You can however create handlers for global Ext.Ajax events beforerequest and requestcomplete http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Ajax-event-beforerequest and count active connections yourself.
Or, if the Selenium tests are to be run in modern browsers, you could try Progress Listeners (with these).
For Firefox, you could create a simple addon that would wait for async requests to complete, and ship that addon with your Selenium tests.