I have a drop-down which should display a list of items. Somehow, the drop-down fails to appear and provide me with options. When I run my test case, the drop-down does not appear. I have used and tried different methods to get rid of this issue, such as. waitUntil, isDisplayed, waitUntilExcpectedConditions, isEnabled
also with various locators from the time it was working as expected like XPath,CSS etc.No luck though. Ideally, these methods should throw a NoSuchElementException
if it cannot find the given element by using locators or when the timeout gets exhausted in case of wait. Nothing seems to work, can anyone help me with this issue.
selenium version : 2.28.0 Chrome Driver version : 2.37.543654 Chrome version : 65.0.3325.162
Enter code here...
public void waitUntilElementIsPresentByCss(String cssSelector)
{
WebDriverWait wait = getWebDriverWaitInstance();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(cssSelector)));
logger.info("retuned waitUntilElementIsPresent ");
}
Enter code here...
public void waitUntilElementIsPresentByXpath(String xpath)
{
WebDriverWait wait = getWebDriverWaitInstance();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpath)));
logger.info("retuned waitUntilElementIsPresent ");
}
Enter code here...
public WebDriverWait getWebDriverWaitInstance() {
if (wait == null)
{
wait = new WebDriverWait(selenium, Integer.parseInt(localProperties.getProperty("timeOut")));
}
return wait;
}