['id_department', choice(department_list)], ] 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()], ['id_cnpj', gen_digits(14)], ['id_ie', gen_digits(12)], ] 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']],
gender = 'id_gender_1' dict_ = gen_female_first_name() else: gender = 'id_gender_0' dict_ = gen_male_first_name() treatment = dict_['treatment'] first_name = dict_['first_name'] last_name = gen_last_name() print(first_name, last_name) slug = '{}-{}'.format(first_name.lower(), last_name.lower()) email = slug + '@example.com' cep = '{}-{}'.format(gen_digits(5), gen_digits(3)) complement_ = '{} {}'.format(complement(), gen_digits(2)) photo = 'http://icons.iconarchive.com/icons/icons-land/vista-people/256/Office-Customer-Male-Light-icon.png' search = page.find_element_by_id(gender) search.click() fields = [ ['id_treatment', treatment], ['id_first_name', first_name], ['id_last_name', last_name], ['id_slug', slug], ['id_email', email], ['id_cpf', gen_cpf()],
search.click() INDEX = randint(0, 146) fields = [ ['id_treatment', treatment], ['id_first_name', first_name], ['id_last_name', last_name], ['id_slug', slug], ['id_photo', photo], ['id_company', choice(company_list)], ['id_department', choice(department_list)], ['id_email', email], ['id_cpf', gen_cpf()], ['id_rg', gen_rg()], ['id_cnpj', gen_digits(14)], ['id_ie', gen_digits(12)], ['id_address', address_list[INDEX]['address']], ['id_complement', 'Apto 303'], ['id_district', address_list[INDEX]['district']], ['id_city', address_list[INDEX]['city']], ['id_uf', address_list[INDEX]['city']], # deixa city mesmo ['id_cep', address_list[INDEX]['cep']], ] for field in fields: search = page.find_element_by_id(field[0]) search.send_keys(field[1]) # button = page.find_element_by_id('id_submit') button = page.find_element_by_class_name('btn-primary')
search = page.find_element_by_class_name('btn-primary') search.click() time.sleep(0.5) # title # author # publication_date # pages # price # book_type fields = [ ['id_title', gen_book()['title']], ['id_author', gen_book()['author']], ['id_publication_date', convert_date(gen_date())], ['id_pages', gen_digits(4)], ['id_price', gen_decimal(5, 2)], ] # driver.find_element_by_css_selector('.modal-footer > button[data-dismiss="modal"]') for field in fields: search = page.find_element_by_css_selector( '.modal-book > id_title') # field[0]) search.send_keys(field[1]) time.sleep(0.2) # button = page.find_element_by_id('id_submit') # button = page.find_element_by_class_name('btn-primary') # button.click()