Search code examples
webdriver-io

Getting the following error when clicking on Login button with webdriver: Request failed due to element click intercepted


When clicking on the login button using below XPATH getting following error: Request failed due to element click intercepted, see below image of HTML code:

XPATH:

('//*[@id="btnLogin"]');

('//a[@id="btnLogin"]');

('#btnLogin');

('//a[@id="btnLogin"]/text()');

('//a[contains(@id, "btnLogin")]');

('//a[@id="btnLogin" and @class = "big-button lnkbuttonlogin"]');

Request failed due to element click intercepted


Solution

  • //*[@id='btnLogin']

    //a[@id='btnLogin']

    Above locators should work , press F12 . go to elements tab .Type ctrl +F and search for matching nodes using above locators .

    Alternatively , Try clicking using a Javascript . import org.openqa.selenium.JavascriptExecutor;

    String idloc="btnLogin";
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("document.getElementById('"+idloc+"').click();");