Skip to main content

Posts

Excel Read Write Library over Apache POI

Simple Library class for Excel Read and Write operations using Apache POI package com.apache.excel.example;importjava.io.FileNotFoundException;importjava.io.FileOutputStream;importjava.io.IOException;importjava.util.Calendar;importjava.util.Date;importorg.apache.poi.ss.usermodel.Cell;importorg.apache.poi.ss.usermodel.Row;importorg.apache.poi.ss.usermodel.Sheet;importorg.apache.poi.ss.usermodel.Workbook;importorg.apache.poi.xssf.usermodel.XSSFWorkbook;publicclassExcelOperations{ Workbook workbook;publicExcelOperations(String filePath){try{ workbook =new XSSFWorkbook(filePath);}catch(IOException e){thrownewRuntimeException("Error while reading workbook",e);}}publicExcelOperations(){ workbook =new XSSFWorkbook();}public Object getValue(int sheetIndex,int rowIndex,int colIndex){ Sheet sheet = workbook.getSheetAt(sheetIndex);returngetValue(sheet, rowIndex, colIndex);}public Object getValue(String sheetName,int rowIndex,int colIndex){ Sheet sheet = workbook.getSheet(she…
Recent posts

Mobile Device - Perform Swipe / Scroll

Example : How to perform Swipe screen using Appium for Mobile device.


package com.vikas.automation.example;importjava.net.MalformedURLException;importjava.net.URL;importjava.time.Duration;importjava.util.concurrent.TimeUnit;importorg.openqa.selenium.Dimension;importorg.openqa.selenium.WebElement;importorg.openqa.selenium.remote.DesiredCapabilities;importorg.testng.annotations.Test;importio.appium.java_client.AppiumDriver;importio.appium.java_client.TouchAction;importio.appium.java_client.android.AndroidDriver;importio.appium.java_client.remote.AndroidMobileCapabilityType;importio.appium.java_client.remote.MobileCapabilityType;publicclassAndroidLinkedInTest{@TestpublicvoidtestMobileSwipe()throws MalformedURLException { URL appiumUrl =new URL("http://127.0.0.1:4723/wd/hub"); DesiredCapabilities caps =new DesiredCapabilities(); caps.setCapability(MobileCapabilityType.APP,"C:\\Users\\vikas\\O2\\apps\\BookMyShow_5.3.0.apk"); caps.setCapability(MobileCapabilityT…

Customizing ExtentReport : Adding External Link

Extent Report  (http://extentreports.com/) is undoubtedly a great Reporting Library for any test automation framework.

Below is one example of how to customize ExtentReport for your project need.

The example will guide you on How to add a Hyperlink into HTML report.



Step 1: Create your own class as below

import com.aventstack.extentreports.markuputils.Markup;
/** * Class that represents Hyperlink */ class ExtentLink implements Markup { private String linkUrl; public String getLinkUrl() { returnthis.linkUrl; } publicvoid setLinkUrl(String linkUrl) { this.linkUrl = linkUrl; } public String getLinkText() { returnthis.linkText; } publicvoid setLinkText(String linkText) { this.linkText = linkText; } private String linkText; @Override public String getMarkup() { final String htmlTag = "+this.linkText+"; returnhtmlTag; } @Override public String toString() { returnthis.linkText; }
}
*Target is specified as _blank so the link will open in new window. You you wants to open in same window then remove target='…

Tutorial : Setting up Selenium GRID in LAN

Trying to learn and set up selenium GRID in local network? Here is the simple tutorial to start with.
Selenium GRID - components Selenium GRID Hub Selenium GRID Node Step 1: Start Selenium GRID HUB Server  java  -jar selenium-server-standalone-3.3.1.jar -role hub

After running this command you will a message as  below

16:55:49.766 INFO - Selenium Grid hub is up and running
17:16:34.636 INFO - Nodes should register to http://192.168.0.128:4444/grid/register/

Step 2: Start Selenium GRID NODE 2.1 Go to node machine & node configuration file with below JSON FileName: nodeConfiguration.json


   "capabilities":[ 
      { 
         "browserName":"chrome",
         "maxInstances":10,
         "platform":"WIN8",
         "version":"58",
         "seleniumProtocol":"WebDriver"
      },
      {
         "browserName":"firefox",
         "maxInstances":3,
 …

Opening url in new Window?

How to open a new window with a new URL while browser automation session is ongoing?
Have you encountered situation where you are automating a website and same time you need to open other browser window to do something like read OTP or read E-Mail and come back to the AUT window and proceed automation...

I am sure If you are working in web automation testing you might have encountered this.

What solution we have ?
Launch a new WebDriver instance while one is having AUT loaded.For example below code :// Initial WebDriver instance to perform Automation Testing on AUT // (if Selenium 3.0 then set webdriver.gecko.driver path) WebDriver driver = new FirefoxDriver(); driver.get("http://myAUT.com"); // TODO: perform some automation stuff // .... // Now I want to open gmail in new window without disturbing // myAUT.com site // So launch a new WebDriver instance WebDriver gmailBrowser = new FirefoxDriver(); gmailBrowser.get("http://www.gmail.com"); // Perform operations like r…

Handling unexpected poupus and alerts while automation with selenium webdriver

Software Configuration Management

Topics being covered What is SCM? & Need of SCM SCM and Productivity Functional Areas of SCM Software Configuration Identification Software Configuration Control SC Status Accounting & Reporting Software Configuration Audits SCM Tools CVS ClearCase VSS Why do Software Configuration Management? Some common issues of developers: I want my work back, and I want it back now. The problem occurred because client was running wrong version of the software. Ops! The bug was solved but it suddenly reappeared. The developed and tested feature is suddenly missing. Ops! Some wrong files were complied and sent to client. What is SCM? Configuration Management is a umbrella activity similar to SPM & SQA. If you don’t control the changes, it controls you. SCM is essential part of Project Management and solid software Engineering Practices. SCM Definition: Software Configuration Management is a set of engineering procedures for tracking and documenting software throughout its life cycle, to en…