0

enter image description hereclicking on service provider exposes a submenu and i need to select one of the options in the submenu. i keep getting not interactableas error...

org.openqa.selenium.ElementNotInteractableException: element not interactable (Session info: chrome=73.0.3683.86) (Driver info: chromedriver=73.0.3683.20 (8e2b610813e167eee3619ac4ce6e42e3ec622017),platform=Mac OS X 10.14.0 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'

  • Could you share the region of the DOM and the code? – João Farias Mar 31 at 11:16
  • I think which one element you want to select is not the drop down option, it's a clickable submenu so you need to select that element directly by the Locators. – Upkar Singh Apr 1 at 6:48
1

What you need to do is, create separate WebElement variables for each action in the dropdown, for example, the main element is "Drinks", its submenu is "Non-Alcoholic" & its submenu is "RedBull".

So for this, there will be 3 separate WebElements, and perform click event using Actions. You can perform as many clicks as you want. And an answer to your question is to add sleep between the clicks. That thing worked for me.

    WebElement Food = driver.findElement(By.xpath("//*[@id='main-menu']/div/ul/li[11]/a"));
    WebElement Drinks = driver.findElement(By.xpath("//*[@id='drinks']/span[1]"));
    WebElement RedBull = driver.findElement(By.xpath("//*[@id='redbull']/span[1]"));

    Actions action = new Actions(driver);
    action.moveToElement(Food).click().moveToElement(Drinks).click().build().perform();
    Thread.sleep(200);
    action.moveToElement(RedBull).click().build().perform();
  • Hi dhairya, Just implemented your solution in my work & its working. Thanks! – jensi suthar Apr 1 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.