NgWebDriver-Automating Angularjs Application Using Selenium


NgWebDriver-Automating Angularjs Application Using Selenium


While trying to automate any angular application using selenium most of us face issues like synchronization and absence of angular specific locator like ngbinding, ngmodel, ngrepater, etc.

So In this article, we are going to discuss one of the most asked questions I usually faced on Automating Angular application using Selenium.

To automate angular application using selenium we can make use of ngWebDriver.




What is ngWebDriver?

A small library of WebDriver locators and more for AngularJS (v1.x) and Angular (2, 3, 4, 5, 6, 7, 8), for Java. It works with Firefox, Chrome and all the other Selenium-WebDriver browsers.

ngWebDriver is the most convenient solution for the above issues as it has taken javascript from the Angular Protractor project.

ngWebDriver supports below locator like

ByAngular.repeater("")
ByAngular.exactRepeater("")
ByAngular.binding("")
ByAngular.exactBinding("")
ByAngular.model('')
ByAngular.options("")
ByAngular.buttonText("")
ByAngular.partialButtonText("")
ByAngular.cssContainingText("")



To start working with ngWebDriver we can download its maven dependency using this link.

To download the jar file use this link.

In this example, I am using the below maven dependency. 



We have to start with creating an object of ngWebDriver and pass our chrome or firefox driver in that.

Below is the sample code implementation.


Please note we can also make use of conventional locator using by class along with an Angular locator strategy like ByAngular.



SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
Anonymous
December 18, 2019 at 11:19 AM

Hello Ankur,

Thanks for sharing this amazing article... as a new in Automation Testing I learned a lot

Reply
avatar
Anonymous
January 26, 2020 at 3:25 PM

Hi Ankur,

Can you provide page object model for ngwebdriver

Reply
avatar
Jiaullah
February 2, 2020 at 3:05 AM

Have you found the page Object model pattern for ngWebdriver. if yes please help me

Reply
avatar
August 2, 2021 at 1:03 PM

Hello Ankur,

Nice article. I would love to share this with my QA automation testing Friends. It will helpful for them. By using images you made it easier to understand. Thank you for sharing.

Reply
avatar