-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
public class Readandwrite {
public static void main(String[] args) throws IOException {
Workbook wb = new XSSFWorkbook();
FileOutputStream f = new FileOutputStream("C:\\Users\\Desktop\\Selenium\\FileHandling\\MyExcelSheet.xlsx");
Sheet s = wb.createSheet("MySheet");
s.createRow(0).createCell(0).setCellValue("[email protected]");
s.getRow(0).createCell(1).setCellValue("abc123");
wb.write(f);
//public static void read() throws IOException {
File S = new File("C:\\Users\\Desktop\\Selenium\\FileHandling\\MyExcelSheet.xlsx");
FileInputStream input = new FileInputStream(S);
XSSFWorkbook wb1 = new XSSFWorkbook(input);
XSSFSheet Sh = wb1.getSheet("MySheet");
}}
public class ReadandWrite2 extends Readandwrite {
ChromeDriver cd;
//@parameters ({"UserName","pass"})
@BeforeTest
public void ReadandWriteExcel() {
System.setProperty("webdriver.chrome.driver","C:\\Users\Desktop\\Selenium\\chromedriver_win32\\chromedriver.exe");
cd=new ChromeDriver();
cd.get("https://www.facebook.com/login.php");
}
@test
public void usernameandpassword() {
WebElement UserName=cd.findElement(By.id("email"));
WebElement pass= cd.findElement(By.id("pass"));
UserName.sendKeys(Sh.getRow(1).getCell(0).getStringCellValue());//Error
pass.sendKeys(Sh.getRow(1).getCell(1).getStringCellValue());//Error
cd.findElement(By.xpath("//*[@id="loginbutton"]")).click();
}}
Metadata
Metadata
Assignees
Labels
No labels