-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercicio_05.py
35 lines (24 loc) · 1016 Bytes
/
exercicio_05.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from selenium.webdriver import Firefox
from time import sleep
browser = Firefox(executable_path='./geckodriver')
url = "https://selenium.dunossauro.live/exercicio_05.html"
browser.get(url)
def preenche_forms(form, nome, senha):
"""Preenche os forms 4 dinamicamente
Args:
form ([type]): [Nome do form a ser preenchido]
text ([type]): [Texto a ser passado para o input]
"""
browser.find_element_by_css_selector(f'.form-{form} input[name="nome"]').send_keys(nome)
browser.find_element_by_css_selector(f'.form-{form} input[name="senha"]').send_keys(senha)
browser.find_element_by_css_selector(f'.form-{form} input[name="{form}"]').click()
# Code
sleep(3)
# Preenche o primeiro formulário
preenche_forms('l0c0', 'diego', '123')
# Preenche o segundo formulário
preenche_forms('l0c1', 'lucio', '345')
# Preenche terceito formulário
preenche_forms('l1c0', 'mario', '678')
# Preenche quarto form
preenche_forms('l1c1', 'paula', '91011')