How to Click on a Checkbox Selenium
<p>My goal is to check a checkbox on a website. The html:</p>

<pre><code>&lt;label class="checkbox" for="are_terms_agreed"&gt;
&lt;input name="terms" id="are_terms_agreed" class="checkbox__input required-entry validate-checkbox" value="1" type="checkbox"&gt;
&lt;span class="checkbox__span"&gt;
&lt;i class="checkbox__icon"&gt;&lt;/i&gt;
&lt;/span&gt;
&lt;span class="checkbox__title"&gt;
I have read and agree to the 
&lt;span class="signup__label-terms"&gt;
&lt;a onclick="return false;" href="https://shop.adidas.ae/en/help/terms-conditions.html" class="js-dialog-btn" data-target="js-dialog-terms"&gt;
Terms &amp;amp; Conditions
&lt;/a&gt;
for website use
&lt;/span&gt;
&lt;/span&gt;
&lt;/label&gt;
</code></pre>

<p>Original link: <a href="https://shop.adidas.ae/en/checkout/onepage/" rel="nofollow">https://shop.adidas.ae/en/checkout/onepage/</a> (you might have to add a shoe to a cart and proceed the checkout process to view the page I'm viewing)</p>

<p>I have tried a few different ways to accomplish this.
Firstly, I have tried to access the</p>

<p><code>IWebElement termsandconditions2 = driver.FindElement(By.XPath("//label[@class = 'checkbox']//label[@for = 'are_terms_agreed']"));</code></p>

<p>I get the error:</p>

<blockquote>
  <p>An unhandled exception of type 'OpenQA.Selenium.NoSuchElementException' occurred in WebDriver.dll
  Additional information: Unable to locate element: {"method":"xpath","selector":"//label[@class = 'checkbox']//label[@for = 'are_terms_agreed']"}</p>
</blockquote>

<p>I have also tried: </p>

<p><code>IWebElement termsandconditions = driver.FindElement(By.CssSelector("span[class*='checkbox__span']"));</code></p>

<p>This is basically clicking on the actual "check" icon, rather than checking the whole box as I tried before. When I run this, I get the error:</p>

<blockquote>
  <p>An unhandled exception of type 'OpenQA.Selenium.ElementNotVisibleException' occurred in WebDriver.dll Additional information: Element is not currently visible and so may not be interacted with</p>
</blockquote>

<p>I have tried using scroll down code, nothing happens.</p>

<p>Any help? Thanks</p>