-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchTest.java
83 lines (49 loc) · 1.67 KB
/
SearchTest.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
public class SearchTest {
static WebDriver driver = null;
@BeforeTest
public void setUpTest()
{
String projectPath = System.getProperty("user.dir");
System.out.println("projectPath : "+projectPath);
System.setProperty("webdriver.chrome.driver",projectPath+"/driver/chromedriver.exe");
driver = new ChromeDriver();
}
@Test
public void SearchProcess() throws InterruptedException {
driver.get("https://www.lookoidbd.com/my-account/");
Thread.sleep(2000);
driver.manage().window().maximize();
//Input Username
driver.findElement(By.id("username")).sendKeys("iftee");
Thread.sleep(1000);
//Input Password
driver.findElement(By.id("password")).sendKeys("6655779966");
Thread.sleep(1000);
//Login Button Click
driver.findElement(By.xpath("//button[@name='login']")).click();
Thread.sleep(1000);
//search prod
driver.findElement(By.xpath("//*[@id=\"menu-item-300\"]/a/span")).click();
Thread.sleep(1000);
//search
driver.findElement(By.xpath("//div[@class='site-tools']/span[1]")).click();
Thread.sleep(1000);
//searchbox
driver.findElement(By.id("woocommerce-product-search-field-3")).sendKeys("Panjabi");
Thread.sleep(1000);
//enter
driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/form/button")).click();
Thread.sleep(5000);
}
@AfterTest
public void tearDownTest() {
driver.close();
driver.quit();
}
}