Enhanced Angular testing with ngWebDriver

There’s a small library called ngWebDriver, which adds support for Angular-specific locators such as model, binding and others.

Homepage:

Download JAR library:
https://mvnrepository.com/artifact/com.paulhammant/ngwebdriver

Usage in Katalon Studio (KS):

  1. Download JAR library
  2. In KS, go to Project - Settings - External Libraries
  3. Add JAR library, Apply and reboot KS

Sample code:

import com.kms.katalon.core.webui.driver.DriverFactory
import com.paulhammant.ngwebdriver.ByAngular
    
WebElement angularElem = DriverFactory.getWebDriver().findElement(ByAngular.binding("ngBinding"))
angularElem.click()

ByAngular class has the same purpose as WebDriver’s By class - it allows to access element using different Angular-specific locators. Full list of supported methods can be found on author’s GitHub page (first link).

5 Likes