0

org.openqa.selenium.ElementNotInteractableException: element not interactable "when interacting with VueSelect

so guys, in my current project i was interacting with VueSelect since we are using Nuxt.js i got the error : org.openqa.selenium.ElementNotInteractableException: element not interactable when i execute my code like below :

 WebElement currency = driver.findElement(By.id("select_currency")); Assert.assertTrue(currency.isDisplayed()); currency.click(); Thread.sleep(3000); currency.sendKeys("Indonesian Rupiah"); Thread.sleep(3000); currency.sendKeys(Keys.ENTER); // below the frontend code in case you guys need it <label>Currency</label> <VueSelect :class=" validationContext.errors[0] ? 'vs__dropdown-toggle-invalid' : '' " :options="listCurrency" placeholder="Select Currency" label="text" v-model="selectCurrency" id="select_currency" ></VueSelect> 

i use Thread.sleep so i could check the interface

before the code failed this is the latest condition before it's shut down

before it shut down

it seems like it got error at the code : currency.sendKeys("Indonesian Rupiah"); anybody could give me insight about this?

i hope i could get some help

4
  • Two things. Firstly, don't do Thread.sleep. Instead use (WebDriverWait) wait.until(ExpectedConditions.presenceOfElementLocated(...). But the issue you are having could be that you need to click the textfield first before you can sendkeys.
    – JonR85
    CommentedMay 21, 2023 at 12:12
  • yes, as you can see at my code, i click the textfield first before i sendkeysCommentedMay 21, 2023 at 12:18
  • Ah, I see now. Then chances are you might be using the wrong webelement. I see you are finding it by id. But sometimes you have to drill down a div or two to find the 'input' element.
    – JonR85
    CommentedMay 21, 2023 at 12:28
  • hmmm let me check it out thenCommentedMay 22, 2023 at 2:18

1 Answer 1

-1

The error you're facing, org.openqa.selenium.ElementNotInteractableException: element not interactable, typically occurs when an element on the web page is found but cannot be interacted with using the specified method.

#solution 1 Wait for the element to become interactable: It's possible that the element is not immediately ready for interaction when the currency WebElement is located. You can try using explicit waits to ensure the element is present and interactable before performing actions on it.

WebElement currency = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("select_currency"))); 

#solution 2 Scroll into view: If the VueSelect component is not in the visible area of the web page, you may need to scroll it into view before interacting with it. You can use the scrollIntoView JavaScript function to bring the element into the view.

JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].scrollIntoView(true);", currency); 

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.