Consider the following source code,
<
Here is the logic to get all elements in Java. You can adopt it to your need.
You have to use findElements() and not findElement() to get all elements.
List items = driver.findElements(By.cssSelector("ul#GroupContactListWrapper div.contactNameItem"));
foreach(item in items){
System.out.println(item.getText();
}
If you want a particular element from the list you can use items.get(1)