Skip to content

Instantly share code, notes, and snippets.

@jfunez
Created March 4, 2016 13:39
Show Gist options
  • Save jfunez/66c67a53d967058d222c to your computer and use it in GitHub Desktop.
Save jfunez/66c67a53d967058d222c to your computer and use it in GitHub Desktop.
example of login with selenium
# 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