-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment196.java
More file actions
51 lines (33 loc) · 1.5 KB
/
Assignment196.java
File metadata and controls
51 lines (33 loc) · 1.5 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
48
49
50
51
package TestNGCLAssignments;
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.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
//WAP to login to amazon & using search component program find out if the testcase is pass or fail?
public class Assignment196 {
WebDriver driver;
@Test
public void amz01() throws EncryptedDocumentException, IOException, InterruptedException {
FileInputStream f1 = new FileInputStream(
"C:\\Users\\USER\\eclipse-workspace\\SeleniumBasics\\DDT\\Abhilash.xlsx");
Workbook f2 = WorkbookFactory.create(f1);
String un = f2.getSheet("sheet4").getRow(0).getCell(0).getStringCellValue();
String pswd = f2.getSheet("sheet4").getRow(0).getCell(1).getStringCellValue();
String Excep = "Amazon";
driver = new ChromeDriver();
driver.get("https://www.amazon.in/ref=nav_logo");
driver.findElement(By.xpath("//span[@Class='nav-line-2 ']")).click();
driver.findElement(By.name("email")).sendKeys(un);
driver.findElement(By.className("a-button-input")).click();
Thread.sleep(2000);
driver.findElement(By.name("password")).sendKeys(pswd);
driver.findElement(By.id("signInSubmit")).click();
Assert.assertEquals(driver.getTitle(),Excep,"sorry the title is not mateched");
}
}