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?
My code:
WebDriverWait waitWait = new WebDriverWait(driver, 40);
waitWait.until(ExpectedConditions.visibilityOfElementLocated(By.className("withoutService")));
WebElement x = driver.findElement(By.className("withoutService"));
x.click();
and also a html code snippet from webpage:
<div id="fancybox-outer">
<div id="fancybox-content">
<div style="width:auto;position:relative;">
<div id="serviceReminder" style="width: 765px">
<form id="serviceReminderFrom" method="post">
<div class="homeMessage">
<div class="innerMessage">
<input type="hidden" id="serviceToAddReminderFromAction" name="F_ACTION" value="">
<input type="hidden" id="itemsWithServices" name="itemsWithServices" value="">
<input type="hidden" name="eventTypeName" value="Something">
<div class="ServicesDelivery"><span class="disable-button"></span>
<a href="javaScript:void(0);" rel="3" class="withoutService btn btn-fourth" onclick="registerButtonClickOnPopup('NO SERVICE'); setTimeout(function(){registerButtonClickOnPopup('NO SERVICE');},400);">NO SERVICE</a>
<a href="javascript:void(0)" rel="1" class="next js-tooltip btn btn-second" onclick="registerButtonClickOnPopup('ADD SERVICE'); setTimeout(function(){registerButtonClickOnPopup('ADD SERVICE');},400);">ADD SERVICE</a>
<div class="none">
</div>
<div class="clear"></div>
</div>
</div>
</div>
</form>
</div></div></div><a id="fancybox-close" style="display: inline;"></a><div id="fancybox-title" class="" style="display: none;">
</div><a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a><a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a></div>