Commit 08a5f2c4 authored by Qazi Zain's avatar Qazi Zain

Sixth Commit in which i have added Auto Suggestive Dropdown

parent d29d8db6
...@@ -6,6 +6,8 @@ import org.openqa.selenium.WebElement; ...@@ -6,6 +6,8 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.Select;
import java.util.ArrayList;
import java.util.List;
public class WebElementAutomation { public class WebElementAutomation {
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
WebDriver obj = new FirefoxDriver(); WebDriver obj = new FirefoxDriver();
...@@ -63,6 +65,22 @@ public class WebElementAutomation { ...@@ -63,6 +65,22 @@ public class WebElementAutomation {
obj.findElement(By.xpath("(//a[@text='Chennai (MAA)'])[2]")).click(); // usually use that kind of xpath when full path also give similar value. obj.findElement(By.xpath("(//a[@text='Chennai (MAA)'])[2]")).click(); // usually use that kind of xpath when full path also give similar value.
//---------------------------------> Auto suggestive Dropdown <----------------------------------------------
obj.findElement(By.id("autosuggest")).sendKeys("ind");
Thread.sleep(3000);
List<WebElement> obj2 = obj.findElements(By.cssSelector("li[class='ui-menu-item'] a"));
for(WebElement objects: obj2)
{
if(objects.getText().equalsIgnoreCase("India"))
{
objects.click();
}
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment