find media items with selenium

  • 1 Replies
  • 910 Views
find media items with selenium
« on: June 06, 2016, 19:54:38 pm »
I have a collection of media items in my app that have the class 'img-gr'. when I try find element with class name, it finds only the first item, but I want click on the second item.

How can i find item no. 2 ?

Re: find media items with selenium
« Reply #1 on: June 14, 2016, 09:27:35 am »
Use the findElements method instead of findElement and place them in a list like so:
Code
List<WebElement> elements = driver.findElements(by.id(...));

Then you can access the 2nd item:
Code
elements.get(1).click();

 

Sitemap 1 2 3 4 5 6 7 8