Here is an interesting problem (or at least i think so)
As an Admin I have a table with N entries (51 to give a number). Each entry in a row is a recruiter name with a link to 'Login' as that person.
I want to be able to click on each recruiter 'login' which takes me to that account, verify some facts there, logout, Relogin as the admin and continue the cylcle (login as recruiter,verify,logout etc)
I find the elements in the table by finding each row and then each cell. (find_elements_by_tag_name("tr")find_elements_by_tag_name("tr")
followed by find_elements_by_tag_name("td") find_elements_by_tag_name("td")
).
The problem arises when iI Logout as the recruiter and ReLogin as the admin, now the cells that iI had found earlier throw a stale element exceptions.
for row in rows:
if chk == "true":
cells[6].find_element_by_link_text("Login").click() # recruiter login
alert = driver.switch_to_alert()
alert.accept()
#Verify Recruiter account is the same as the one you logged in as
driver.find_element_by_link_text("Logout").click()
self.login() #admin login
self.bringUpRecruiters()
I could call the function which finds the rows and columns at each iteration. However, it takes half a minute for webdriver to find all the cell elements (51 rows x 7 columns) at each iteration. For 51 iterations that is approximately 25 mins. And if the number of rows increase it will only increase more.
Is there a more elegant and time saving way of doing this ? I would appreciate your bright ideas!
I am using Webdriver + Python bindings
Thanks, S.