4

I'm using Ruby with mechanize gem to try to scrape data from a website. my question is, after login on the referenced page, the website launches a new page where the actual data lives. How to I reference that new page in mechanize?

script so far:

require 'mechanize'

a = Mechanize.new
page = a.get('http://www.obfuscation.com')
formd = page.forms[0]

formd.txtUserName = 'username'
formd.txtPassword = 'password'
formd.submit

This is where I lose track programatically of the new spawned browser window.

your help is greatly appreciated

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Dieter
  • 83
  • 1
  • 5
  • Be advised that mechanize is not meant to interact with JavaScript. You may want to look into Watir which acts like a full fledged browser. – binarymason Oct 07 '15 at 12:07
  • Thanks, just looked at it. seems like it will work. odd thing is it actually opens a browser, i'd prefer to not see it but oh well – Dieter Oct 07 '15 at 23:50

0 Answers0