­

This blog is for Automation Test Engineers

Friday, 16 February 2018

To print content of excel

FileInputStream fis=new FileInputStream ("E://data.xlsx"); Workbook wb=WorkbookFactory.create(fis); Sheet s=wb.getSheet("test");//sheet name int rc=s.getlastRowNum(); for(int i=0;i<=rc;i++) { Row r=s.getRow(i); } int cc=r.getlastCellNum(); for(int j=0;j<cc;j++){ Cell c=r.getCell(j); String v=c.getStringcellvalue(); System.out.print(v); }...
0

Handling Frames

Frames is an html document which is embedded inside another document. If we right click on any element in context menu if it shows "this frame" then element is present inside another frame. Inorder to handle this we should transfer control to frame. This can be done by using 3 ways: driver.switchTo().frame(int index no); driver.switchTo().frame(String frame name); driver.switchTo().frame(Web Element frameElement); After switching to frame we can perform any operation only within frame. In order to handle the element which is outside...
1

How to close specified browser in Child browser popup in selenium webdriver

//open browser WebDriver driver=new FirefoxDriver(); //navigate to website driver.get(https://www.hdfcbank.com/); //windowhandle of parent browser String a=driver.getWindowhandle(); System.out.print(a); //click on login button driver.findElement(By.id(“loginsubmit”)).click(); //Size of windowhandles  child browser Set<String> b=driver.getWindowhandles(); System.out.print(b.size()); // windowhandles of  child browser Iterator<String>c=driver.getWindowHandles().iterator(); While(c.next()){ String...
0

How to handle Child browser popup in selenium webdriver

//open browser WebDriver driver=new FirefoxDriver(); //navigate to website driver.get(https://www.hdfcbank.com/); //windowhandle of parent browser String a=driver.getWindowhandle(); System.out.print(a); //click on login button driver.findElement(By.id(“loginsubmit”)).click(); //Size of windowhandles  child browser Set<String> b=driver.getWindowhandles(); System.out.print(b); // windowhandles of  child browser Iterator<String>c=driver.getWindowHandles().iterator(); While(c.next()){ String...
0