Not able to click Search button and also select the option from the drop down Getting:
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Reason: After selecting the value from the dropdown list the cursor remains in the dropdown text box and is not going to the Search button
Can someone please let me know what can be done
WebElement Searchbox = driver.findElement(By.xpath("//span[contains(normalize-space(),'Search')]/preceding::button[contains(@onclick,'mainForm:messages2')]")); WebDriverWait wait = new WebDriverWait(driver,50); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[contains(normalize-space(),'Search')]/preceding::button[contains(@onclick,'mainForm:messages2')]"))); Searchbox.click();
below is the Html code: - I am trying to click on the Search button
<td role="gridcell" class="ui-panelgrid-cell" colspan="2">
<button id="mainForm:j_idt441" name="mainForm:j_idt441" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
onclick="PrimeFaces.ab({s:"mainForm:j_idt441",u:
"mainForm:projectG
groupsTable mainForm:messages2"});
return false;" type="submit" role="button" aria-disabled="false">
<span class="ui-button-text ui-c">Search</span>
</button>
</td>