-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment_152.java
More file actions
37 lines (19 loc) · 824 Bytes
/
Assignment_152.java
File metadata and controls
37 lines (19 loc) · 824 Bytes
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
package BasicsSelenium;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//WAP to launch amazon, select books from the dropdown menu then search for power using Keys function?
public class Assignment_152 {
public static void main(String[] args) throws InterruptedException {
ChromeDriver driver = new ChromeDriver();
driver.get("https://amazon.com");
driver.manage().window().maximize();
WebElement d1 = driver.findElement(By.id("twotabsearchtextbox"));
d1.sendKeys("mobiles");
Thread.sleep(5000);
List<WebElement> s1 =driver.findElements(By.xpath("//div[@class='s-suggestion s-suggestion-ellipsis-direction']/div/div"));
int count =s1.size();
System.out.println(s1);
}
}