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'

2
  • Could you share the region of the DOM and the code? Commented Mar 31, 2019 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. Commented Apr 1, 2019 at 6:48

2 Answers 2

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();
1
  • Hi dhairya, Just implemented your solution in my work & its working. Thanks! Commented Apr 1, 2019 at 9:47
0

here iam getting org.openqa.selenium.elementnotinteractableexception element not interactable, i have written explicit wait also, please reply with the solution as soon as possible

import java.util.Iterator; import java.util.Set; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;

public class MissalaniousTopics {

public static void main(String[] args) throws InterruptedException {
    // TODO Auto-generated method stub
    System.setProperty("webdriver.chrome.driver", "//Users//narsaiahdhoda//Downloads//chromedriver");
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.rahulshettyacademy.com/AutomationPractice/");
    driver.manage().window().maximize();
    // ---Getting size of links which referred by anchor tag-----//
    System.out.println(driver.findElements(By.tagName("a")).size());
    System.out.println(driver.findElements(By.tagName("iframe")).size());
    // --navigating to another web site--//
    Thread.sleep(7000);
    driver.navigate().to("https://www.spicejet.com/");

    // how many frames are in the web site
    System.out.println(driver.findElements(By.tagName("iframe")).size());
    WebDriverWait a = new WebDriverWait(driver,10);
    a.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("(//span[@class='text-label text-active'])[2]")));
    String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL, Keys.RETURN);
    driver.findElement(By.xpath("(//span[@class='text-label text-active'])[2]")).sendKeys(selectLinkOpeninNewTab);
    System.out.println("last");
    Thread.sleep(40000);
    driver.quit();

// Set windowsids=driver.getWindowHandles(); // Iterator i=windowsids.iterator(); // String parentid =i.next(); // String childid=i.next(); // driver.switchTo().window(childid); // driver.close();

}

}

1
  • This looks like a new question, not an answer to the existing question. It also looks like you opened this as a new question: sqa.stackexchange.com/questions/44962/… If this is a new question, this answer should be deleted.
    – Lee Jensen
    Commented Jun 16, 2020 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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