-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdropdownpractice.java
More file actions
38 lines (28 loc) · 1.11 KB
/
dropdownpractice.java
File metadata and controls
38 lines (28 loc) · 1.11 KB
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
package intro_selenium;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class dropdownpractice {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Users\\JPZ4373\\Documents\\chromedriv\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://rahulshettyacademy.com/dropdownsPractise/");
WebElement staticDropdown = driver.findElement(By.xpath("//select[@name='ctl00$mainContent$DropDownListCurrency']"));
Select dropdown = new Select(staticDropdown);
dropdown.selectByVisibleText("INR");
driver.findElement(By.className("paxinfo")).click();
Thread.sleep(2000);
/* int i = 1;
while (i<5) {
driver.findElement(By.id("hrefIncAdt")).click();
i++;
} */
for (int i = 1;i<5;i++) {
driver.findElement(By.id("hrefIncAdt")).click();
}
driver.findElement(By.id("btnclosepaxoption")).click();
}
}