Tuesday 25 July 2017

Protractor JAVA: Writing a simple script using Jprotractor jar file

Hi All,

Hope you are doing good.

In this blog i would like to walk through to write a simple program in Java to calculate sum of  2 numbers in Angular application: 

  • ·         Create a new project in eclipse editor
  • ·         Add Selenium java client drivers to your project
  • ·         Add above created Jprotractor jar file to your project
  • ·         Create a package and create  a class
  • ·         Write a command to launch chrome driver as below: ·          

  • System.setProperty("webdriver.chrome.driver", "C:\\Users\\uname\\Downloads\\chromedriver_win32\\chromedriver.exe");
            WebDriver driver= new ChromeDriver();
    ·         Create an object to NgWebdriver a below:
    NgWebDriver nDriver= new NgWebDriver(driver);
    ·         Write webdriver commands using nDriver as shown in below code snippet: 

NgBy.Modal, NgBy.buttonText(): we have 10-12 supported methods are there which you can get detailed information from the below link only https://github.com/sergueik/jProtractor


We will see how to write few more programs using this jar file in next tutorial



Tuesday 18 July 2017

Protractor : How to use JAVA programming language for protractor

Hi All,

Hope you are doing good.

As you are aware we have to use NodeJS in writing code for protractor to automate angular JS application.

In this post i would like to give you an idea how can we write protractor code using java programming language.

We need a jar file which supports Protractor methods and we need to add that jar file to our eclipse editor which is JProtractor.

Please find the below steps to create JProtractor jar file:


  • ·         Download the code from this location as shown below: https://github.com/sergueik/jProtractor



  • ·         Unzip the downloaded folder
  • ·         Open the command prompt
  • ·         Switch to the folder exactly we have above downloaded zip file
  • ·         Remove the java folder from this location src/test/java
  • ·         mvn clean package
  • ·         it will take sometime to generate jar file
  • ·         You can find the jar file from the below location

·         C:\developer\username\jProtractor\target\jprotractor-1.2-SNAPSHOT.jar


In the next post we are going show an example how to write a program in your eclipse editor

Thanks,
Surendra Jaganadam