def insert_random_seller(self, repeat=qsellers): ''' Inserir registros com valores randomicos ''' seller_list = [] for _ in range(repeat): d = gen_timestamp(2014, 2015) + '+00' fname = names.get_first_name() lname = names.get_last_name() email = fname[0].lower() + '.' + lname.lower() + '@example.com' birthday = gen_timestamp() + '+00' active = rstr.rstr('01', 1) internal = rstr.rstr('01', 1) commissioned = rstr.rstr('01', 1) commission = 0.01 seller_list.append( (gen_doc(), fname, lname, email, gen_phone(), birthday, active, internal, commissioned, commission, d, d)) try: self.db.cursor.executemany(""" INSERT INTO vendas_seller (cpf, firstname, lastname, email, phone, birthday, active, internal, commissioned, commission, created, modified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) """, seller_list) self.db.commit_db() print("Inserindo %s registros na tabela vendas_seller." % repeat) print("Registros criados com sucesso.") except sqlite3.IntegrityError: print("Aviso: O email deve ser único.") return False
last_name = names.get_last_name() name = '{} {}'.format(first_name, last_name) email = '{}.{}@example.com'.format(first_name[0].lower(), last_name.lower()) page = webdriver.Chrome(executable_path='/home/rg3915/Downloads/chromedriver') page.get('http://localhost:8000/inscricao/') search = page.find_element_by_id('id_name') search.send_keys(name) time.sleep(1) search = page.find_element_by_id('id_cpf') search.send_keys(gen_doc()) time.sleep(1) search = page.find_element_by_id('id_email') search.send_keys(email) time.sleep(1) search = page.find_element_by_id('id_phone') search.send_keys(gen_phone()) time.sleep(2) button = page.find_element_by_id('id_submit') button.click() # page.quit()