java - List of WebElement find by className return Xpath -
i've got multiple div on webpage have same class attribute. i'm looking way check div of page specific class name, , get, each of div, xpath.
actually, can check how many div have on page class name :
list<webelements> test = driver.findelements(by.classname("fitter")); int countdiv = test.size();
do have idea, now, elements xpath 1 one ? or have different solution ?
my project selenium project , i'm testing web page. test written in java , i'm using webdriver.
thanks
simply iterate through list of webelements?
list<webelement> elements = driver.findelements(by.classname("fitter")); (int = 0; < elements.size(); i++) { webelement element = elements.get(i); // ... whatever need here }
the xpath of each element in loop
//div[contains(@class, 'fitter')][i]
Comments
Post a Comment