2

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.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
AutomationTest
  • 101
  • 1
  • 2
  • 13
  • The label tag sort of steals all the events... though you shouldn't really need the click, you can move that to the – pcalkins Mar 24 '22 at 18:50
  • Does this answer your question? [ElementClickInterceptedException: Message: element click intercepted: Element – Prophet Mar 24 '22 at 20:40

2 Answers2

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:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

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);
arpita biswas
  • 144
  • 1
  • 6