Skip to content

Instantly share code, notes, and snippets.

@tsundara
Last active January 26, 2017 00:37
Show Gist options
  • Save tsundara/0b372011a19b939f45379fa793f3f41a to your computer and use it in GitHub Desktop.
Save tsundara/0b372011a19b939f45379fa793f3f41a to your computer and use it in GitHub Desktop.
Selenium Python Login Test on Chrome
# This gist shows how to perform Browser testing using Selenium Webdrier & Python
#Ensure that you have downloaded ChromeDriver.exe and placed it in some directory,say C:/binaries
#Also make sure C:/binaries is set in your windows %PATH%. For testing, you can use the below set command :
#set PATH=C:/binaries;%PATH%
from selenium import webdriver
browser = webdriver.Chrome()
#If a blank Chrome window opens up, you are good to proceed with next steps
browser.get('http://website:8000/Login')
username = browser.find_element_by_id("loginname")
password = browser.find_element_by_id("passwd")
username.send_keys("admin@website.com")
password.send_keys("secretpassword")
#This will click the Submit or Login button
browser.find_element_by_name("loginBtn").click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment