How to select the auto suggestion from the dynamic dropdown using Selenium and Java

The code below worked for me.

    WebDriver Driver = new ChromeDriver();
    Driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    //Driver.manage().window().maximize();
    String url = "https://demoqa.com/automation-practice-form";
    Driver.get(url);
    WebElement products=Driver.findElement(By.id("subjectsInput"));
    products.sendKeys("English");
    products.sendKeys(Keys.ARROW_DOWN);
    products.sendKeys(Keys.ENTER);
    

Leave a Comment