AngularJS - how to wait for views to change?

905 views
Skip to first unread message

Dan Baughman

unread,
Jan 11, 2017, 9:41:03 PM1/11/17
to Selenium Users
I'm using the firefox selenium ide for automated web app testing - it is just awesome.

My current app is built in angular - how do I get the firefox selenium ide to wait for views to finish rendering before issuing the next command?

I can always put a wait / sleep command, but I would much rather have it actually just wait until the view is loaded somehow and then perform the action.

Thanks in advance,

Dan B.

Bhabani Sankar Mishra

unread,
Jan 12, 2017, 2:13:18 AM1/12/17
to Selenium Users
In Java you have - 
WebElement element = (new WebDriverWait(driver, 10)).until(ExpectedConditions.visibilityOfElementLocated(By.id("element_id")));

This will wait for 10 sec for the element to be visible before timing out. 

Regards,
Bhabani

harshal shewale

unread,
Jan 12, 2017, 6:22:48 AM1/12/17
to Selenium Users
Go to https://www.seleniumpoint.com for more details.

Dan Baughman

unread,
Jan 12, 2017, 5:20:05 PM1/12/17
to Selenium Users
That site does not appear to be up for me - it is using the wrong SSL cert name and has a place holder site.

Oscar Rieken

unread,
Jan 12, 2017, 5:51:41 PM1/12/17
to seleniu...@googlegroups.com
the angular team has a wrapper around webdriver called protractor http://www.protractortest.org/#/ I would suggest giving that a shot I do not recommend using the ide. due to the dynamic behavior of angular.js you would be spending most of you time trying to find work around for behavior that is already supported in protractor

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9af71c9b-ade3-4c24-a516-a6b241885c20%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Serguei Kouzmine

unread,
Jan 12, 2017, 6:47:54 PM1/12/17
to Selenium Users

Basically, Protractor  does wait for Angular  to finish rendering the page
```
angular.element(el).injector().get('$browser').
            notifyWhenNoOutstandingRequests(callback);

```

This is a fragment of the Javascript function waitForAngular  that is basically executed in the scope of every FindElement and other methods

You can find Java ports of Protractor in
https://github.com/caarlos0/jProtractor
https://github.com/henrrich/jpagefactory
and C# in https://github.com/bbaia/protractor-net

Please feel free to ask further questions -  i am developer of the java port
Serguei Kouzmine
Reply all
Reply to author
Forward
0 new messages