Home > Net >  Clicking on input checkbox with Selenium C#
Clicking on input checkbox with Selenium C#

Time:10-14

I'm trying to click on input checkbox item on the Target.com website it looks like Selenium is trying to click on the whole label and I'm not able to click the input. The error output I get is:

OpenQA.Selenium.ElementClickInterceptedException : element click intercepted: Element

<input id="buyOnlineAndGetShipped" name="buyOnlineAndGetShipped" type="checkbox" class="styles__CheckboxInput-sc-1v63imw-1 hLCJBJ" value=""> 

is not clickable at point (348, 503). Other element would receive the click:

<div class="styles__CheckboxVisual-sc-1v63imw-5 gxIeGa"></div>

What I'm trying to do is go to enter image description here

CodePudding user response:

You should maximize the browser in full screen mode and then you can try with Java script executor like below :

The below css has unique entry in HTMLDOM :

IWebElement e = Driver.FindElement(By.CssSelector("label[for='checkAvailabilityBeforeStoreTrip'] div"));
((IJavaScriptExecutor)Driver).ExecuteScript("arguments[0].click();", e);
  • Related