I'm trying to select an option from an auto suggestive dropdown. When I enter the string into the dropdown sendKeys(keys.down) is not moving to the option. I'm getting a 'cannot focus element' error. I have added screen shots of the code and the dropdown on the screen. This is the code.
JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("document.getElementById('proposer.occupation- selectized').value = 'Composer';"); driver.findElement(By.xpath("//*[@id='content']/div4/div/div1/div[8]/div2/div/div1/div")).sendKeys(Keys.DOWN); driver.findElement(By.id("proposer.occupation-selectized")).getText(); String script = "return document.getElementById('proposer.occupation-selectized').value;";
String text=(String) jse.executeScript(script);
System.out.println(text);