-1

Tried executing the code but getting:

ElementNotInteractableException: element not interactable 

for the below sendKeys statement. What could be the solution??

WebElement ss = driver.findElement(By.cssSelector("div[class='select__single-value css-1uccc91-singleValue']"));
ss.click();
ss.sendKeys("abc");
4
  • 2
    use sendkeys to input element not div Commented Feb 8, 2021 at 15:15
  • I have used sendkeys only as you can see in the last statement.That is where I am facing the error Commented Feb 8, 2021 at 15:18
  • @use it on <input> not <div> Commented Feb 8, 2021 at 15:19
  • dine element that starts wit h<input> Commented Feb 8, 2021 at 15:19

2 Answers 2

0

Generally <div> tags are not interactable unless [contenteditable="true"] (How to modify the innerHTML of a contenteditable element) is attribute is explicitly set.


Solution

If your usecase is to invoke click() / sendKeys() generally you have to invoke on <input> elements but not on <div>. Try to identify the element using the inspector opening the and identify the desired <input> element.


References

You can find a couple of relevant detailed discussion on ElementNotInteractableException in:

Sign up to request clarification or add additional context in comments.

Comments

0

Please make sure you are using the correct path as div tags are usually not interactable.

By.cssSelector("div[class='select__single-value css-1uccc91-singleValue']");

Here, you are using the compound class which is no longer allowed in selenium. So, try using:

By.cssSelector("div[class='.select__single-value.css-1uccc91-singleValue']");

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.