Skip to content

Instantly share code, notes, and snippets.

@jwoertink
Created April 28, 2010 21:10
Show Gist options
  • Select an option

  • Save jwoertink/382724 to your computer and use it in GitHub Desktop.

Select an option

Save jwoertink/382724 to your computer and use it in GitHub Desktop.
require 'johnson'
require 'johnson/tracemonkey'
require 'envjs'
require 'envjs/runtime'
envjs = Johnson::Runtime.new
envjs.extend Envjs::Runtime
window = envjs.evaluate("window")
window.location = 'http://inmateinfo.cityofhenderson.com/Default.aspx'
head = window.document.getElementsByTagName('head')[0]
script = window.document.createElement('script')
script.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js')
script.setAttribute('type', 'text/javascript')
head.appendChild(script)
envjs.evaluate('jQuery()') #=> [object Object]
envjs.evaluate("$(':checkbox:first').click()")
window.document.getElementById("txtSearchName").value = "aa"
new_window = envjs.evaluate("$('#btnSearch').click()")
table = envjs.evaluate('window.document.getElementById("gvSearchResults")')
table.innerHTML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment