I'm having trouble returning the results page after using Mechanize (in Ruby) to auto enter search fields and auto click submit button.
The problem is that the 3 second loading page gets returned, NOT the actual results page which loads a few seconds later.
Putting a sleep in there obviously isn't working.
require 'mechanize'
agent = Mechanize.new
url = 'https://www.intelius.com'
agent.get(url) do |page|
form = page.forms.first
username_field = form.field_with(:id => "peopleSearch_firstName")
username_field.value = "John"
password_field = form.field_with(:id => "peopleSearch_lastName")
password_field.value = "Lee"
city_state_field = form.field_with(:id => "peopleSearch_cityState")
city_state_field.value = "Van Nuys, CA"
page_logged_in = form.submit
sleep(5)
puts page_logged_in.body
end