Home > OS >  Selenium element not interactable with same id
Selenium element not interactable with same id

Time:12-04

I have a base page class like this

public class BasePage{
    @FindBy(id = "select2-ccnl-container")
    protected WebElement ccnlSelect;

    public void clickSettingCcnl(){
        ccnlSelect.click();
    }
}

then i created 2 class Page1 and Page2 both extending BasePage. those are 2 different pages containing an element with that id. When i use the clickSettingCcnl() in a test on Page1 everything is ok.

But the same thing on Page2 gave me org.openqa.selenium.ElementNotInteractableException: element not interactable

The element is visible and clickable on Page1 and so it seems on Page2.

CodePudding user response:

The element with said id was inside another one, in Page2 it had a class added dynamically that set its dimension to 0 but i didn't notice it because of the parent element hiding this transformation.

By removing that class it got back to a dimension > 0 and hence clickable by Selenium

  • Related