-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment171_.java
More file actions
47 lines (30 loc) · 1.29 KB
/
Assignment171_.java
File metadata and controls
47 lines (30 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package BasicsSelenium;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.NumberToTextConverter;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//WAP to login to facebook using DDT concept?
public class Assignment171_ {
public static void main(String[] args) throws EncryptedDocumentException, IOException {
FileInputStream f1 = new FileInputStream(
"C:\\Users\\USER\\eclipse-workspace\\SeleniumBasics\\DDT\\Abhilash.xlsx");
Workbook w1 = WorkbookFactory.create(f1);
String s1 = w1.getSheet("sheet1").getRow(0).getCell(0).getStringCellValue();
String s2 = NumberToTextConverter.toText(w1.getSheet("sheet1").getRow(1).getCell(0).getNumericCellValue());
System.out.println(s1);
System.out.println(s2);
ChromeDriver driver = new ChromeDriver();
driver.get("https://www.facebook.com/login/");
driver.manage().window().maximize();
WebElement e1 = driver.findElement(By.id("email"));
e1.sendKeys(s1);
WebElement e2 = driver.findElement(By.id("pass"));
e2.sendKeys(s2);
driver.findElement(By.id("loginbutton")).click();
}
}