0

Hii can any one tell me how to loop a list of web elements using java and selenium web driver here is my code

these are the objects

 By ProjectSummaryReport_Campaign = By.name("q.a.62.d");
 By ProjectSummaryReport_ProjectTitle = By.name("q.a.1.d");
 By ProjectSummaryReport_ProjectAllocation = By.name("q.a.63.d");
 By ProjectSummaryReport_JobNumber = By.name("q.a.2.d");
 By ProjectSummaryReport_ArchivalStatus = By.name("q.a.6.d");
 By ProjectSummaryReport_StartDate = By.name("q.a.7.d");
 By ProjectSummaryReport_EndDate = By.name("q.a.8.d");

this is the code

Wrappers.Click(ProjectSummaryReport_Campaign);
Wrappers.Click(ProjectSummaryReport_ProjectTitle);
Wrappers.Click(ProjectSummaryReport_ProjectAllocation);
Wrappers.Click(ProjectSummaryReport_JobNumber);
Wrappers.Click(ProjectSummaryReport_ArchivalStatus);
Wrappers.Click(ProjectSummaryReport_StartDate);
Wrappers.Click(ProjectSummaryReport_EndDate);

Click_Link method

public static void Click(By byobj) {
    _driver.findElement(byobj).click();
}

please dont mined if any thing is wrong I am very new to this selenium automation thanks is advance for solutions

Pushpa
  • 17
  • 1
  • 2
  • 5
  • possible duplicate of [Ways to iterate over a List in java?](http://stackoverflow.com/questions/18410035/ways-to-iterate-over-a-list-in-java) – SiKing Oct 16 '14 at 20:21

1 Answers1

0

you meant smthing like this?

    List<WebElement> list = Arrays.asList(WebElement, WebElement1, WebElement2...);
    for(WebElement el : list){
        el.click();
    }
user3535807
  • 248
  • 2
  • 3
  • 15