-3

When i Hit on checkbox here error display.

WebElement  checkbox = driver.findElement(By.xpath("//*[@id=\"modelSelfRegistration\"]/div/div/div[2]/div[2]/div[1]/div[2]/label"));

if(!checkbox.isSelected())

checkbox.click();

Screenshot for my code & error below.

http://prntscr.com/nkavtz

S Ahmed
  • 1,454
  • 1
  • 8
  • 14
Pratik
  • 13
  • 7
  • provide html code.. looks locator issue – murali selenium May 04 '19 at 13:08
  • 1
    Please read why [a screenshot of code is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Paste the code and properly format it instead. – JeffC May 04 '19 at 13:29

1 Answers1

0

Use the javascript to click on the element, rather using checkbox.click();

 JavascriptExecutor js = (JavascriptExecutor) driver; 
 js.executeScript("arguments[0].click()",checkbox);
supputuri
  • 13,644
  • 2
  • 21
  • 39