0

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

1 Answer 1

1

With the given limited data in the question, it is pretty unclear but as far as my understanding goes it not the same piece of code. We should segregate the page classes and test cases(@test).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.