-
Notifications
You must be signed in to change notification settings - Fork 0
/
Objectarray.java
61 lines (48 loc) · 1.58 KB
/
Objectarray.java
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
52
53
54
55
56
57
58
59
60
61
package excelfile;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class Objectarray {
public WebDriver driver;
@BeforeMethod
public void openpage()
{
System.setProperty("webdriver.edge.driver","msedgedriver.exe");
WebDriver driver = new EdgeDriver();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.get("https://demowebshop.tricentis.com/");
driver.manage().window().maximize();
driver.findElement(By.linkText("Log in")).click();
this.driver=driver;
}
@DataProvider(name="logindata")
public Object[][] passdata()
{
Object[][] data= new Object[4][2];
data[0][0]="tafajjul@gmail.com";
data[0][1]="zilani";
data[1][0]="tafajju@gmail.com";
data[1][1]="zilan123i";
data[2][0]="tafa1@gmail.com";
data[2][1]="tafajjul";
data[3][0]="tafajjulzilan@gmail.com";
data[3][1]="zilani";
return data;
}
@Test(dataProvider = "logindata")
public void loginwebshop(String username,String password) {
driver.findElement(By.xpath("//input[@name='Email']")).sendKeys(username);
driver.findElement(By.xpath("//input[@name='Password']")).sendKeys(password);
driver.findElement(By.xpath("//input[@class='button-1 login-button']")).click();
}
@AfterMethod
public void exit()
{
driver.close();
}
}