When we create Page(Class) for some WebElement(driver.findElements(By.xpath("//h4[@class='card-title']")) and this element is a part of a List do we change only that part im main testcase(after creating method for it) and the remaining is the same or not? example:
List<WebElement> products =driver.findElements(By.xpath("//h4[@class='card-title']"));
for(int i=0;i<products.size();i++)
{
String name=products.get(i).getText();
if(name.contains("Samsung"))
{
driver.findElements(By.xpath("//div[@class='card-footer']/button")).get(i).click();
break;
}
}
I am not sure about that and that's the reason for question