Dongkun Lee Dongkun Lee -4 years ago 70
Ruby Question

Ruby : Mechanize cannot find any content from the site what i want to check

i want use auto login for specific web site

so i decided to use "Mechanize"

In example, like, It works!

require 'rubygems'
require 'mechanize'

a = { |agent|
agent.user_agent_alias ="Windows Chrome"

page = a.get('')


but when set url to

I cannot find any content

I tried several functions like

  • page.links



But I cannot catch any content in this site

How can I get login contents from the site

Answer Source

That page has two iframes so you need to click the iframe first, then only you can find the elements.

require 'rubygems'
require 'mechanize'

a =
page = a.get('')
p = page.frames[1].click
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download