I was not sure If it is right place to ask this question but since I start to use this framework. I though you can help me out :). Basically, I am facing an issue where by I am trying to create a block Bootstrap Select2 element with ajax search. When I am searching I am getting StaleElementReferenceException most of the time because of issue described http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp.
So I would like to know how do you solve this issue. I thought you may have came across this issue since it is common functionality. Any help appreciated!
Here is snipped of code I have
public void selectByValue(String value){
selectLink.click();
searchTextInput.clear();
searchTextInput.sendKeys(value);
List<WebElement> options = getWrappedElement().findElements(By.xpath("//*[@id='select2-drop']/ul/li/div/div"));
if(options.size() == 0){
throw new NoSuchElementException("Cannot locate option with name: " + value);
}
for (WebElement option : options) {
if (option.getText().equals(value)) {
option.click();
break;
}
}
}
Hi all,
I was not sure If it is right place to ask this question but since I start to use this framework. I though you can help me out :). Basically, I am facing an issue where by I am trying to create a block Bootstrap Select2 element with ajax search. When I am searching I am getting StaleElementReferenceException most of the time because of issue described http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp.
So I would like to know how do you solve this issue. I thought you may have came across this issue since it is common functionality. Any help appreciated!
Here is snipped of code I have