Mechanize iframes

Hi,
could anyone give me an idea how can I get any element inside iframe
using mechanize?

i get
irb(main):026:0> page.iframes
=> [‘view_frame’ -> /something?some_id=1234]
how can I fill form, click on links inside this iframe?

I’ve try several ways including something perl like:

irb(main):028:0> page.links(:tag, “view_frame”)
ArgumentError: wrong number of arguments (2 for 1)

I will appreciate any help

regards

Hey,

On Tue, Aug 08, 2006 at 05:20:11AM +0900, [email protected] wrote:

Hi,
could anyone give me an idea how can I get any element inside iframe
using mechanize?

i get
irb(main):026:0> page.iframes
=> [‘view_frame’ -> /something?some_id=1234]
how can I fill form, click on links inside this iframe?

Ruby Mechanize treats frames like links. You’ll need to “click” the
iframe before you can manipulate html loaded in the iframe. Try
something like the following:

iframe_page = agent.click page.iframes.first
iframe_page.forms.each do |form|
p form
end

Also see the RDoc for WWW::Mechanize::Frame. Hope that helps.

–Aaron

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs