Home > Mobile >  Selenium Button not clickable
Selenium Button not clickable

Time:09-29

After passing the username and password, I'm trying to click on the login button. username and password insert properly but it is not clicking the "login" button and fail the test. There are two login buttons that exist with different LinkText and I was able to capture the specific login button by following XPath.

"//button[contains(string(), "Login")]"

This is the error message that I'm getting

Step failed Element is not clickable

I have tried the below solutions as well but didn't work any of them

  1st Method 

WebDriverWait wait = new WebDriverWait(driver,30);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Login")));
// click on the compose button as soon as the "compose" button is visible
    driver.findElement(By.linkText("Login (en)")).click();
    <a href="http://LOGGER.info" target="_blank">LOGGER.info</a>("clicked return on a button");
    
2nd Method 

WebDriverWait myWaitVar = new WebDriverWait(driver,20);
WebElement el = myWaitVar.until(ExpectedConditions._elementToBeClickable_(By._xpath_("//button[contains(string(), "Login")]")));
<a href="http://el.click" target="_blank">el.click</a>();

3rd Method 

WebElement element = driver.findElement(By._linkText_(" Login "));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().preform();

CodePudding user response:

Update xpath as below. If this also does not work with normal click, try using java script executor.

"//button[contains(text(), 'Login')]"

  • Related