<pre><code>You are using string concatnation here ..
fullListNames += listName // thats the problem please refer below code i have replaced the selenium components you can add it depending upon your requirement.
also fullListNames should be an array
fullListNames =[]
def gather_names1():
fullListNames = []
#hover_names = self.browser.find_elements_by_xpath("//div[contains(@class, 'recent-names')]") #xpath to the names that will need to be hovered over
# #for names in hover_names:
# self.hover_over(names) #hover_over is a method which takes an xpath and will then hover over each of those elements
# self.wait_for_element("//div[contains(@class, 'recent-names-info')]", 'names were not found') #Checking to see if it is displayed on the page; otherwise, a 'not found' command will print to console
# time.sleep(3) #giving it time to find each element, otherwise it will go too fast and skip over one
# listName = names.find_element_by_xpath("//div[contains(@class, 'recent-names-info')]").text #converts to text
for i in range(10):
listName="user"+str(i)
fullListNames.append(listName)#currently adding every element to a string
print fullListNames
return fullListNames
gather_names1()
i got the below output
['user0', 'user1', 'user2', 'user3', 'user4', 'user5', 'user6', 'user7', 'user8', 'user9']
</code></pre>