Skip to content

Instantly share code, notes, and snippets.

@kevinthompson
Last active December 18, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinthompson/5788979 to your computer and use it in GitHub Desktop.
Save kevinthompson/5788979 to your computer and use it in GitHub Desktop.
Submit an ASP.net form by clicking a WebForm link using Mechanize.
require 'mechanize'
# Fetch the home page
browser = Mechanize.new
home_page = browser.get('https://www.example-aspnet-site.com/')
# Fill out the login form
login_form = home_page.forms.first
login_form.field_with(:name => /UserName/i).value = ARGV[0]
login_form.field_with(:name => /Password/i).value = ARGV[1]
user_dashboard = home_page.link_with(:text => /Login/).click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment