How do I insert information on the page that is in the excell

0

Good afternoon guys, I would like to know if anyone can help me ...

I'm automating a page and would like to know if it's possible to use an excell worksheet to populate the fields ...

For example:

Today I am using the following command, it inserts in the element mname the Mariano information, this I inserted manually.

driver.find_element_by_id("mname").send_keys("mariano") 

What do I need? I need that instead of this Mariano, it looks for an information that is in an excell worksheet, so I will use the excell as a parameter without having to touch my script

driver.find_element_by_id("mname").send_keys("Dados da coluna A2 do Excell")

Thank you very much.

    
asked by anonymous 29.11.2018 / 19:59

2 answers

0

If you use a CSV in Excell, you can do this with direct file manipulation or with the csv , which is part of the standard library. If you use the xlsx format, you'll need an external module to read the file. There are several.

    
01.12.2018 / 04:19
0
import xlrd

book = xlrd.open_workbook("planilha.xls")
sh = book.sheet_by_index(0)

def test_e_cadastroI(self, mem_dc=None):
driver.find_element_by_id("fname").send_keys(sh.cell_value(rowx=2-1, colx=1-1))

......

    
03.12.2018 / 16:59