ngWebDriver – a way to automate angular apps in selenium using java

Problem –

In one of my earlier post Selenium java for angularJS apps, we have seen how we can use selenium webdriver and java to test angular js controls, but there are few limitations like we need to stick to a particular locator strategy (xpath or css) as selenium itself do not have locators method specific to angular controls [like ngbinding, ngrepeater etc], and sometime angular element’s actions lag behind the selenium line by line execution [synchronisation issue]


Solution – ngWebDriver

To over come above said issues while testing angular js controls with selenium and java, a library known as ngWebDriver came out to add features to selenium and can write the scripts in java [so that we need not to switch or learn any other languages like javascript for protractor]

ngwebdriver basically taken the advantage of protractor and passing the javascript to browser to handle angular controls and also allows to write scripts in java language with out any synchronisation issue.

Let’s list our few angular controls that are different than normal html elements





If you observe, we can not use these controls value directly using selenium webdriver and java like id, tagname, link etc..

but ngwebdriver has capability to identify the above elements directly, let’s see




byAngular.repeater(str) – Angular web table

Code implementation

Let’s see sample implementation of ngWebDriver

Setup ngWebDriver is simple, simply add ngwebdriver-x.x.jar file to your existing selenium project and follow below code.

Download the jar file from here

If you want to use ngWebDriver maven dependency – you can find here



Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *