Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

My Data driven code is not run #3

Copy link
Copy link
@shilpatailor4

Description

@shilpatailor4
Issue body actions

package automationFramework;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class ReadWriteExcel {

WebDriver driver;
WebDriverWait wait;
HSSFWorkbook workbook;
HSSFSheet sheet;
HSSFCell cell;

@BeforeTest

public void TestSetup() {
	
	//Set the path of the Firefox Driver
	System.setProperty("webdriver.gecko.driver", "E:\\Shilpa\\Selenium\\geckodriver.exe");
	WebDriver driver = new FirefoxDriver();
	
	//Enter URL
	driver.get("http://www.linkedin.com/");
	driver.manage().window().maximize();
	
	wait = new WebDriverWait(driver, 30);
	driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	
	
}

@Test

public void ReadData(int it) throws IOException {
	
	//Import Excel sheet
	File src = new File("E:\\Shilpa\\Selenium\\TestData.xlsx");
	
	//Load the file
	FileInputStream finput = new FileInputStream(src);
	
	//Load the Wrokbook
	workbook = new HSSFWorkbook(finput);
	
	//Load the sheet in which data is stored
	sheet = workbook.getSheetAt(0);
	
	
	for(int i=1; i⁢=sheet.getLastRowNum(); int i; i++)
	{
	
		//Import Data from Email
		cell = sheet.getRow(i).getCell(1);
		cell.setCellType(Cell.CELL_TYPE_STRING);
		driver.findElement(By.name("session_key")).sendKeys(cell.getStringCellValue());
		
		//Import Data for Password
		cell = sheet.getRow(i).getCell(2);
		cell.setCellType(Cell.CELL_TYPE_STRING);
		driver.findElement(By.name("session_password")).sendKeys("");
	}
	
}

}
...................................

Error appears:
1565175984288 Marionette INFO Listening on port 57568
1565175984622 Marionette WARN TLS certificate errors will be ignored for this session
Aug 07, 2019 4:36:24 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[Parent 69828, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1563383129/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.