Test case execution hangs. No exception is thrown even when xpath for an element shows No matching n

14 views
Skip to first unread message

Akash Deep

unread,
May 27, 2018, 10:15:09 PM5/27/18
to Selenium Users

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;
 }



Reply all
Reply to author
Forward
0 new messages