user9347168
user9347168

Reputation:

Selenium, Java and Angular: Element not interactable

The site is running an older Angular version, 5.2.11.

I've got something that looks like a straight input field on the page, but maybe not so straight in the markup:

<div felt fieldname="approxCostDevelop" class="felt" e2e-selector="approx-cost-develop">
   <est-currecy-felt ng-model="develop.price" input-id="approxCostDevelop">
      <translate>Approximate cost of development</translate>
   </est-currency-felt>
</div>

When I try accessing this text field, selenium gives me and Element Not Interactable exception.

I've tried placing the e2e-selector attribute both where it is now, and after the input-id attribute field. I've also tried using the input-id attribut instead of the e2e-selector. Same result every time.

The way I create and access the WebElement:

//@FindBy(css = "[e2e-selector=approx-cost-develop]")
@FindBy(css = "[input-id=approxCostDevelop]")
private WebElement approxCostDevelopTextField;

public void setApproxCostDevelop(String approxCost) {
    pproxCostDevelopTextField.sendKeys(approxCost);
}

It's not a password field or any kind of special field. And it's visible all the time, from the loading of the page. The elements directly before it are a list of checkboxes, which all are interactable.

Upvotes: 1

Views: 604

Answers (1)

Frank H.
Frank H.

Reputation: 1330

It looks like the element is embedded in the tag.

I'm not very familiar with Angular, but: Instead of using @FindBy and creating a named WebElement, try just creating a WebElement with the same name as the input-id. Like this:

private WebElement approxCostDevelop;

Upvotes: 1

Related Questions