thread.sleep and explicit wait are the only way deal with StaleElementException.
show me how are you using explicit code. send the 2 line of code.
Thanks Ashish...
Here is my explicit wait, i have tried below 3 options:
I have defined my WebDriverWait Objref at class level
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@id='portfolioid']/option[text()='"+deletePortfolioName+"']")));
wait.until(ExpectedConditions.elementToBeSelected(By.xpath("//*[@id='portfolioid']/option[text()='"+deletePortfolioName+"']")));
also i tried:
while(!driver.findElement(By.xpath("//*[@id='portfolioid']/option[text()='"+deletePortfolioName+"']")).isSelected()){
dropList.selectByVisibleText(deletePortfolioName);
}
Thanks for your response....
those above methods are fine try these also.
https://gist.github.com/djangofan/5112655