java - FluentWait for dynamically created ListBox -
i have listbox(droplist) item created dynamically when click on div/span element .. however, when try click on listbox element after doing fluent wait , throws me error saying
element not clickable @ point (741, 192). other element receive click:"
if try use thread.sleep(2000)
code runs perfectly. ideas on how can fix issue , make work in fluentwait
. have tried elementtobeclickable,elementselectionstatetobe,presenceofelementlocated methods in expectedconditions class , throw same error. using chromedriver testing purposes .
my code , html snippet of page below
webelement elt = driver.findelement(by.xpath("//*[@id='grouptt']/span[2]/span/span[1]")); //clicking on span listbox activiated actions act = new actions(driver); act.movetoelement(elt).click().build().perform(); fwait.until(expectedconditions.elementtobeclickable(driver.findelement(by.xpath("//ul[@id='group_listbox']/li[2]")))); //thread.sleep(2000) works fine here. driver.findelement(by.xpath("//ul[@id='group_listbox']/li[2]")).click();
html snippet
<div > <ul unselectable="on" id="group_listbox" role="listbox" style="overflow: auto; height: auto;"> <li tabindex="-1" role="option" unselectable="on" class="k-item" data-index="0"> group1 </li> <li tabindex="-1" role="option" unselectable="on" class="k-item k-state-selected k-state-focused" data-index="1"> group2 </li> <li tabindex="-1" role="option" unselectable="on" class="k-item k-state-selected k-state-focused" data-index="1"> group3 </li> </ul> </div>
you can try change xpath locator find element inner text.
fwait.until(expectedconditions.elementtobeclickable(driver.findelement(by.xpath("//li[text() = 'group2']"))));
Comments
Post a Comment