mechanize iframes

P

punkracy

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:
http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize/FAQ.pod#How_do_I_handle_frames?

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

I will appreciate any help

regards
 
A

Aaron Patterson

Hey,

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top