Selenium 2 and Python - ok so Windmill is my new favorite.

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts

Update 4: - Have not tried it yet, but Splinter looks easy as well:
Update 3: You should probably try to use requests first!

Update 2: Turns out Windmill is mostly part of the old Chandler server stuff, so mostly getting crufty... Back to Selenium 2.

Update: Windmill is more fun now

Scripting password changes in webmail using Python and Selenium 2
Selenium is pretty cool!
from selenium import webdriver
import sys
import os

wdrv = webdriver.Firefox()

# first, log in to the webmail interface
unamefield = wdrv.find_element_by_name("username")
pwdfield = wdrv.find_element_by_name("passwd")

# now go to the change password link

# pop over to the correct frame to find the form fields...

# You can peek at the source - to see what is going on
# if you are interactive mode and just writing code (ha ha php!)
#print wdrv.get_page_source()
password = wdrv.find_element_by_name("password")
confirm_password = wdrv.find_element_by_name("confirm")
# if you want a screenshot of the data after submit, you can do it with:

One gotcha. If your form has an item named "submit", this will fail. Find the item named "submit" and pass it .click()
So for example, instead of doing .submit() on the pwdfield, do this:
subbtn = wdrv.find_element_by_name("submit")

Also, for quick testing, you can get screenshots (might want to use time.sleep(seconds) if loading data from a db)...

This looks interesting!: