I am new to , And In my scenario I need to select a product for list of products in the page. And Product name to select is a test data. Now my query is,Can I create Object in Class level ( like Page Obj Model) with parameters?

By itemOne1 = By.xpath("//div[@text='VARIABLE']")  // **@ Beginning of the  class, Page Object Model**

Or do I need to create Object local to method?

By itemOne1 = By.className("product-title");   // @ Beginning of the class

In Method, to get the requested Item

for(WebElement we : itemOnes) {
            System.out.println(we.getText().equals(itemName));
            if(we.getText().equals(itemName)){
                we.findElement(By.tagName("a")).click();
            }
        }

Please clarify ..



Source link https://sqa.stackexchange.com/questions/35140/how-to---in-selenium

LEAVE A REPLY

Please enter your comment!
Please enter your name here