I am trying to click on the span with the text- clone concept. Following is the html
The problem is in your xpath. selenium webdriver is finding a duplicate element by your xpath in screen which is hidden and tring to perform operation on it. Please change the xpath and it will work. I did the same thing in my code..
Basically, there are four reasons why an element is not interactable. No four is usually the solution.
1) Timing - the time it takes for elements to load. For this, you need to check how to use implicit an explicit wait
2) Check if the element is in a frame
3) Incorrect locator
4) Wrong implementation of responsiveness. This still stems from no 3). Some websites have only one code turned on for mobile and web versions. So, the element will have more than one instance when you check the xxxxx.size. You will have to search through the list for the one whose display != none. Then, you can append the position of the element to your xpath or whatever locator you are using. E.g. xxxx/yyyyy/zzzz[3]
if the position is 4 in the list.
Use this code for java,
Assumptions
a) the locator type is id
b) name of the list is nameOfYourElements
List<WebElement> nameOfYourElements = wd.findElements(By.id("nameOfYourID"));
System.out.println(nameOfYourElements.size());
For the above query, here is the xpath:
//ui[@class='context-menu-list context-menu-root']/span[contains(text(),'Clone concept')]
Unfortunately Webdriver doesn't seem to be great at handling situations like that described in your questions. You have a couple of options though. Mock a click using Javascript:
JavascriptLibrary jsLib = new JavascriptLibrary();
jsLib.callEmbeddedSelenium(selenium,"triggerMouseEventAt", elementToClick,"click", "0,0");
or
((JavascriptExecutor) driver).executeScript("arguments[0].click();", elementToClick);
Or you can play around with using actions to click all of the elements in the menu chain. Unfortunately I have found this to be unreliable.
I have a script which detects whether an element is in a menu chain and if it is clicks on them in the required order to finally click on the one the user wanted if you want it I can post it somewhere but it isn't pretty or short.