'ElementClickInterceptedException: element click intercepted: Element <input> is not clickable. Other element would receive the click: <label for="..">
I know i have seen this Question on StackOverFlow but not i am not able to solve my problem:
Error :
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <input type="password" id="Password" name="Password" value="" maxlength="25" placeholder=" " class=""> is not clickable at point (446, 716). Other element would receive the click: <label for="Password">...</label>
(Session info: chrome=99.0.4844.83)
HTML:
<input type="password" id="Password" name="Password" value="" maxlength="25" placeholder=" " class="">
XPATH AND CSS
@FindBy(css = "#Password")
public WebElement password;
@FindBy(xpath = "//input[@id='Password']")
public WebElement password;
My code:
wait.until(ExpectedConditions.elementToBeClickable(password)).click();
wait.until(ExpectedConditions.elementToBeClickable(password)).sendKeys(PASSWORD);
Even JAVASCRIPT Click is not working
executor.executeScript("arguments[0].click();", element);
This is happening for all Checkboxes / input fields on this page. Any solution would be helpful.
Solution 1:[1]
This error message...
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <input type="password" id="Password" name="Password" value="" maxlength="25" placeholder=" " class=""> is not clickable at point (446, 716). Other element would receive the click: <label for="Password">...</label>
(Session info: chrome=99.0.4844.83)
...implies that the <input> element is not clickable as the <label> element intercepts the click.
Deep Dive
Presumably the <input> element is preceeded by <label> element as follows:
<label for="Password" ...>
<input type="password" id="Password" name="Password" value="" maxlength="25" placeholder=" " class="">
Solution
In such cases, instead of the <input> element, you need to target the <label> element as follows:
Using css:
@FindBy(css = "label[for='Password']") public WebElement password;Using xpath:
@FindBy(xpath = "//label[@for='Password']") public WebElement password;
and finally:
wait.until(ExpectedConditions.elementToBeClickable(password)).sendKeys(PASSWORD);
References
You can find a couple of relevant detailed discussions in:
Solution 2:[2]
Can you try using JavascriptExecutor instead of sendKeys method to send password info
JavascriptExecutor jse = ((JavascriptExecutor)driver);
WebElement email = driver.findElement(By.id("useremail"));
jse.executeScript("arguments[0].value='---your email id---';", email);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | arpita biswas |
