-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWaitspage.java
54 lines (42 loc) · 2.08 KB
/
Waitspage.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
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.time.Duration;
public class Waitspage {
private WebDriver driver;
private Waitskoarkopage newpage;
@BeforeTest
public void before(){
System.setProperty("Web-driver.chrome.driver","D:\\\\browserdriver\\\\chromedriver\\\\chromedriver.exe");
driver= new ChromeDriver();
newpage=new Waitskoarkopage(driver);
driver.get("https://www.daraz.com.np/#");
driver.manage().window().maximize();
// driver.manage().timeouts().implicitlyWait(TimeOut, TimeUnit.SECONDS);
WebDriverWait parkha=new WebDriverWait(driver, Duration.ofSeconds(100));
parkha.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"Level_1_Category_No8\"]/a/span[2]")));
}
@Test
public void second(){
Actions action=new Actions(driver);
action.moveToElement(newpage.getwomefashion()).perform();
String texta=newpage.getwomefashion().getText();
System.out.println(texta);
// action.keyDown(newpage.getsearch(), Keys.CONTROL).sendKeys("a").sendKeys("").build().perform();
// newpage.getsearch().sendKeys("Women's Fashion");
// newpage.getsearch().sendKeys(Keys.RETURN);
WebDriverWait wait=new WebDriverWait(driver,Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"J_8018372580\"]/div/ul/ul[1]/li[1]/a/span")));
action.moveToElement(newpage.getclothing()).perform();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"J_8018372580\"]/div/ul/ul[1]/li[1]/ul/ul/li[6]/a/img")));
//
action.moveToElement(newpage.getjeans()).perform();
newpage.getjeans().click();
driver.navigate().back();
}
}