Last active
July 11, 2017 16:21
-
-
Save Eduardoveras/ae6140085560d17f88a991146d32be1b to your computer and use it in GitHub Desktop.
This was just for testing selenium in general
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from selenium import webdriver | |
# Register Chrome web driver | |
driver = webdriver.Chrome() # Optional argument | |
driver.get('http://clinic-manager.herokuapp.com/'); | |
time.sleep(3) # Let the user actually see something! | |
#Login with selenium | |
email = driver.find_element_by_name('email') | |
password = driver.find_element_by_name('password') | |
email.send_keys('[email protected]') | |
password.send_keys('1234') | |
password.submit() | |
time.sleep(3) | |
#create patient with selenium | |
driver.get('http://clinic-manager.herokuapp.com/patients'); | |
time.sleep(3) # Let the user see page loaded | |
driver.get('http://clinic-manager.herokuapp.com/new_patient'); | |
time.sleep(3) | |
driver.find_element_by_id('firstName').send_keys('Eduardo') | |
driver.find_element_by_id('lastname').send_keys('Eduardo') | |
driver.find_element_by_id('idCard').send_keys('Eduardo') | |
driver.find_element_by_id('dateofbirth').clear() | |
driver.find_element_by_id('dateofbirth').send_keys('07/09/1994') | |
driver.find_element_by_id('occupation').send_keys('Eduardo') | |
driver.find_element_by_id('religion').send_keys('Eduardo') | |
#select country | |
el = driver.find_element_by_id('country') | |
for option in el.find_elements_by_tag_name('option'): | |
if option.text == 'Angola': | |
option.click() | |
break | |
time.sleep(1) # Let the user see something | |
# City | |
el = driver.find_element_by_id('state') | |
for option in el.find_elements_by_tag_name('option'): | |
if option.text == 'Bengo': | |
option.click() | |
break | |
driver.find_element_by_id('address').send_keys('Eduardo') | |
driver.find_element_by_id('nationality').send_keys('Eduardo') | |
# City | |
el = driver.find_element_by_id('bloodtype') | |
for option in el.find_elements_by_tag_name('option'): | |
if option.text == 'A-': | |
option.click() | |
break | |
driver.find_element_by_id('tags_1_tagsinput_tag').send_keys('hola,prueba,') | |
driver.find_element_by_id('tags_2_tagsinput_tag').send_keys('hola,prueba,') | |
driver.find_element_by_id('telephonenumber').send_keys('8092222222') | |
driver.find_element_by_id('workphone').send_keys('8092222222') | |
driver.find_element_by_id('cellphone').send_keys('8092222222') | |
driver.find_element_by_id('email').send_keys('[email protected]') | |
driver.find_element_by_id('contactname').send_keys('pepe') | |
driver.find_element_by_id('contactlastname').send_keys('pepe') | |
driver.find_element_by_id('contactAddress').send_keys('pepe') | |
driver.find_element_by_id('contacttelephonenumber').send_keys('8092222222') | |
driver.find_element_by_id('contactCellphone').send_keys('8092222222') | |
driver.find_element_by_id('insurancecode').send_keys('8092222222') | |
driver.find_element_by_id('supplier').send_keys('8092222222') | |
driver.find_element_by_id('plan').send_keys('8092222222') | |
driver.find_element_by_xpath("//input[@value='AGREGAR']").click() | |
time.sleep(10) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment