-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment142_.java
More file actions
34 lines (20 loc) · 888 Bytes
/
Assignment142_.java
File metadata and controls
34 lines (20 loc) · 888 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
package BasicsSelenium;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
//WAP to select books from the dropdown in amazon ?
public class Assignment142_ {
public static void main(String[] args) throws InterruptedException {
ChromeDriver driver = new ChromeDriver(); //Lunching the ChromeBrowser
driver.get("https://www.amazon.in/");
driver.manage().window().maximize();
WebElement selectClass = driver.findElement(By.id("searchDropdownBox")); //FindElementByid
Select s1 = new Select(selectClass); //Select class
s1.selectByVisibleText("Books"); //select class Method
// WebElement ClickButton = driver.findElement(By.xpath("//span[@id='nav-search-submit-text']"));
// ClickButton.click();
Thread.sleep(5000);
driver.quit();
}
}