I am trying to parse several columns in a table in a dictionary using Selenium, but what seems to me to be slow. I am using python, Selenium 2.0 and webdriver.Chrome ()
table = self.driver.find_element_by_id("thetable") # now get all the TR elements from the table all_rows = table.find_elements_by_tag_name("tr") # and iterate over them, getting the cells for row in all_rows: cells = row.find_elements_by_tag_name("td") # slowwwwwwwwwwwwww dict_value = {'0th': cells[0].text, '1st': cells[1].text, '2nd': cells[2].text, '3rd': cells[3].text, '6th': cells[6].text, '7th': cells[7].text, '10th': cells[10].text}
It seems that the problem is getting the "text" attribute for each td element. Is there a faster way?
source share