['id_department', choice(department_list)], ['id_occupation', 'Arquiteto'], ] for field in fields: search = page.find_element_by_id(field[0]) search.send_keys(field[1]) # time.sleep(0.5) button = page.find_element_by_link_text('Documentos') button.click() fields = [ ['id_photo', photo], ['id_cpf', gen_cpf()], ['id_rg', gen_rg()], ] for field in fields: search = page.find_element_by_id(field[0]) search.send_keys(field[1]) # time.sleep(0.5) button = page.find_element_by_link_text('Endereço') button.click() fields = [ ['id_address', address_list[INDEX]['address']], ['id_complement', 'Apto 303'], ['id_district', address_list[INDEX]['district']], ['id_city', address_list[INDEX]['city']],