jProtractor & Katalon for Angular

Using JProtractor I was successfully able to execute a sample script with angular attributes in Katalon.

need experts opinion on jProtractor and the best way to integrate with Katalon

Note: First add the jprotractor-1.3-SNAPSHOT to Katalon project.

How to create jProtractor JAR file.

  1. Unzip the downloaded jProtractor file.
  2. Delete the java folder from this location --> src/test/java
  3. Open the command prompt.
  4. Switch to the extracted folder.
  5. mvn clean package
  6. It would take sometime to generate the Jar file.
  7. you will find the jar file in target folder --> jprotractor-1.3-SNAPSHOT.jar

import org.openqa.selenium.WebDriver as WebDriverimport

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver

import com.github.sergueik.jprotractor.NgBy;
import com.github.sergueik.jprotractor.NgWebDriver;

WebUI.openBrowser(‘https://juliemr.github.io/protractor-demo/’)

WebUI.maximizeWindow()

WebDriver webDriver = DriverFactory.getWebDriver()

NgWebDriver driver = new NgWebDriver(webDriver);

driver.findElement(NgBy.model(“first”)).sendKeys(“4”);

driver.findElement(NgBy.model(“operator”)).sendKeys("*");

driver.findElement(NgBy.model(“second”)).sendKeys(“5”);

driver.waitForAngular(); //////////////////////////////

driver.findElement(NgBy.buttonText(“Go!”)).click();

driver.waitForAngular();

Thread.sleep(250L);

driver.navigate().to(“https://angularjs.org/”);

driver.findElement(NgBy.model(“yourName”)).sendKeys(“Katalon”);

String val=driver.findElement(NgBy.binding(“yourName”)).getText();

System.err.println(val);

Thread.sleep(3000);

driver.quit();

3 Likes

Hello Sir,

I’m not an expert but would like to help with this. We have 3 applications written with Angular and have being using Katalon for 8 months.

1 Like

Hi

Can I have your mailid pls
Need help with angular project
I am very new to katalon

Thanks