single instance xpath expression gives error “not interactable”

  Kiến thức lập trình

I have selenium java on my site as follows:

<a href="/logout/" class="btn btn-default btn-block btn-logout no-link-decoration">Abmelden</a>
and
<a href="/logout/" class="no-link-decoration logout-link"> Abmelden</a>

Either Link I select with:

(//a[contains(.,'Abmelden')])[1]

or

(//a[contains(.,'Abmelden')])[2]

I cannot click(), error is:

org.openqa.selenium.ElementNotInteractableException: element not interactable

here is my selenium code:

        login_test_user();

        WebElement logged_in = driver.findElement(By.xpath("//div[contains(.,' test test')]"));

        //Instantiating Actions class
        Actions actions = new Actions(driver);

        //Hovering on main menu
        actions.moveToElement(logged_in);

        WebElement abmelden = driver.findElement(By.xpath("(//a[contains(.,'Abmelden')])[1]"));

        abmelden.click();

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT