Created
March 4, 2016 13:39
-
-
Save jfunez/66c67a53d967058d222c to your computer and use it in GitHub Desktop.
example of login with selenium
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
# pip install selenium | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
driver = webdriver.Firefox() | |
driver.get("http://127.0.0.1:5000/admin/login/") | |
driver.maximize_window() | |
input_login = driver.find_element_by_id('email') | |
input_login.send_keys('test@test.com') | |
input_pass = driver.find_element_by_id('password') | |
input_pass.send_keys('1234') | |
submit_btn = driver.find_element_by_css_selector('button[type="submit"]') | |
submit_btn.click() | |
# driver.close() ou .quit() para fechar o browser quando terminar o script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment