python - Saving the second td text from every tr -


i have table need store invoice numbers in list

enter image description here

then need compare separate similar page.

i not sure how approach this, have written far not sure if right approach.

list = [] table_id = self.driver.find_element(by.id, 'tbldata') rows = table_id.find_elements(by.tag_name, "tr") # of rows in table row in rows:     # columns (all column 2)             col = row.find_elements(by.tag_name, "td")[1] #note: index start 0, 1 col 2     list.append(col) 

you can use below line:

invoices = [td.text td in driver.find_elements_by_xpath("//table[@id='tbldata']//tr[1]/td")] 

also note shouldn't use list variable name reserved name in python


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -