title: Selenium WebDriver Java - Element is not visible
body: <p>I am new to Selenium WebDriver tests and I try to use it at work. I tried many combinations of selectors, xpaths and so on, but I can't move past it. I searched also many similiar topics on stackoverflow, sadly without expected results. What I need is to be able to click on "NO SERVICE" button (a href). When I try, I keep getting error, that this element is not visible. When I try to handle this error using "wait"s, I keep getting another error "Expected condition failed: waiting for visibility of element...". What am I doing wrong?</p>
  
  <p>My code:</p>
  
  <pre><code>    WebDriverWait waitWait = new WebDriverWait(driver, 40);     
      waitWait.until(ExpectedConditions.visibilityOfElementLocated(By.className("withoutService")));      
      WebElement x = driver.findElement(By.className("withoutService"));
      x.click();
  </code></pre>
  
  <p>and also a html code snippet from webpage:</p>
  
  <pre><code>&lt;div id="fancybox-outer"&gt;
      &lt;div id="fancybox-content"&gt;
          &lt;div style="width:auto;position:relative;"&gt;
              &lt;div id="serviceReminder" style="width: 765px"&gt;
                  &lt;form id="serviceReminderFrom" method="post"&gt;
                      &lt;div class="homeMessage"&gt;
                          &lt;div class="innerMessage"&gt;
                              &lt;input type="hidden" id="serviceToAddReminderFromAction" name="F_ACTION" value=""&gt;
                              &lt;input type="hidden" id="itemsWithServices" name="itemsWithServices" value=""&gt;
                              &lt;input type="hidden" name="eventTypeName" value="Something"&gt;
                                  &lt;div class="ServicesDelivery"&gt;&lt;span class="disable-button"&gt;&lt;/span&gt;
                                      &lt;a href="javaScript:void(0);" rel="3" class="withoutService btn btn-fourth" onclick="registerButtonClickOnPopup('NO SERVICE'); setTimeout(function(){registerButtonClickOnPopup('NO SERVICE');},400);"&gt;NO SERVICE&lt;/a&gt;
                                      &lt;a href="javascript:void(0)" rel="1" class="next js-tooltip btn btn-second" onclick="registerButtonClickOnPopup('ADD SERVICE'); setTimeout(function(){registerButtonClickOnPopup('ADD SERVICE');},400);"&gt;ADD SERVICE&lt;/a&gt;
                              &lt;div class="none"&gt;
                              &lt;/div&gt;
                              &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;a id="fancybox-close" style="display: inline;"&gt;&lt;/a&gt;&lt;div id="fancybox-title" class="" style="display: none;"&gt;
          &lt;/div&gt;&lt;a href="javascript:;" id="fancybox-left"&gt;&lt;span class="fancy-ico" id="fancybox-left-ico"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="javascript:;" id="fancybox-right"&gt;&lt;span class="fancy-ico" id="fancybox-right-ico"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
  </code></pre>