In my test, I need to wait for a page to load before proceeding. waitForSelector
and waitForText
aren't working for some reason, and while I can just use a wait(value)
, I'd have to account for times the server might be slow and make the value a lot larger than I'd like; so I was thinking of making a while loop telling the system to wait 500 milliseconds every time it returns that 'someCSSpath' doesn't exist on the page. Is there any way to do this (maybe a "casper.DoesntExist'?), or any better way to do it?
var css3path = "body > div.container-fluid > div:nth-child(3) > div.row.ng-scope > div:nth-child(1) > a > div";
casper.waitForSelector(css3path , function(){
this.test.assertExists(css3path );
if (casper.exists(css3path ){
this.echo("logged in!");}
else{
this.echo("not logged in");
};
});
When I use a casper.wait(6000, function(){
instead of waitForSelector
, it works fine.
I use waitforselector earlier with the same format, and that works too; I think it's the specific thing I'm looking for that's giving me trouble.
Also, when I use wait(6000,
the test finds that CSS3 path just fine; it's just waitForSelector
that can't find it.