html - Extracting data from li tag under ul using Selenium Webdriver -
<ul class="dropdown-menu" aria-labelledby="dlabel"> <li><a href="resource/guide/tcs health insurance - hospitalisation claim reimbursement guidelines.pdf" target="_blank">hospitalization guide</a></li> <li><a href="resource/guide/tcs helath insurance - domiciliary claim reimbursement guidelines.pdf" target="_blank">domiciliary guide</a></li> </ul>
i trying data under each li list not able extract value domiciliary guide above li list.
in below code, list of elements displayed elements first list element, ele.gettext()
not giving output.
can me in extracting data li
?
webelement ul=testdriver.findelement(by.xpath("//*[@id='header']/div/div/ul[1]/li[5]/div/ul")); list<webelement> elements=ul.findelements(by.tagname("li")); system.out.println("elements::"+elements); for(webelement ele:elements){ system.out.println("text"+ele.gettext()); }
thanks!
try one. hope works
list<webelement> li_value = driver.findelements(by.xpath("//*@id='header']/div/div/ul[1]/li[5]/div/ul/li")); for(int = 0; i< li_value.size() ; i++ ) { system.out.println(li_value.get(i).gettext()); }
Comments
Post a Comment