In my application, I have a table with users but the table can have more than 1 page with users. I want to get a list with all users in all pages with Selenium Webdriver Python. I have test function which goes to the first page, gets a list with all users then goes to the second page gets a list of users and until the pages no longer exist:
def test_users1(driver):
login(driver, username="Admin", password="Password")
while True:
try:
#gets list of elements
userslist = driver.find_elements_by_css_selector(".even .odd")
#goes to second page, third...etc.
for i in range(1, 50):
driver.find_element_by_link_text("%s" % i).click()
except NoSuchElementException:
break
return (userslist)
I need to return split list with all users from all pages from my loop
userslist += driver.find_element_by_link_text("%s" % i).click()ifdriver.find_element_by_link_text("%s" % i).click()returns the list of user