Here is the clip: onclick="window.open(''/view/viewFullBill.doview'' There are some other things obviously....but is this just another agent.get? Mike B. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
Jeremy Woertink
2010-Jan-20 18:27 UTC
[Mechanize-users] How do I mechanize a link like this?
Mechanize doesn''t support JavaScript. So any links that have onclick events, or use javascript as their href won''t work. Check out Watir gem You can also look into Johnson or Lyndon (if you use MacRuby). These both can handle Javascript. Good luck. ~Jeremy On Tue, Jan 19, 2010 at 5:17 PM, barsalou <barjunk at attglobal.net> wrote:> Here is the clip: > > onclick="window.open(''/view/viewFullBill.doview'' > > There are some other things obviously....but is this just another > agent.get? > > Mike B. > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20100120/6bc65307/attachment.html>
Or, you can do something like: agent.get page.content.match(/window\.open\(''([^'']+)/)[1] That''s completely untested, but you get the gist. Use a regex to pull out the URL, then get it. Aaron On Wed, Jan 20, 2010 at 10:27 AM, Jeremy Woertink <jeremywoertink at gmail.com>wrote:> Mechanize doesn''t support JavaScript. So any links that have onclick > events, or use javascript as their href won''t work. Check out Watir gem > > You can also look into Johnson or Lyndon (if you use MacRuby). These both > can handle Javascript. > > Good luck. > > ~Jeremy > > > > On Tue, Jan 19, 2010 at 5:17 PM, barsalou <barjunk at attglobal.net> wrote: > >> Here is the clip: >> >> onclick="window.open(''/view/viewFullBill.doview'' >> >> There are some other things obviously....but is this just another >> agent.get? >> >> Mike B. >> >> ---------------------------------------------------------------- >> This message was sent using IMP, the Internet Messaging Program. >> >> _______________________________________________ >> Mechanize-users mailing list >> Mechanize-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/mechanize-users >> > > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20100120/6d34719e/attachment.html>
Quoting Aaron Starr <astarr at wiredquote.com>:> Or, you can do something like: > > agent.get page.content.match(/window\.open\(''([^'']+)/)[1] > > That''s completely untested, but you get the gist. Use a regex to pull out > the URL, then get it. >That''s a good idea too. I think in this case that link won''t change, however. Is there a way to capture, besides ethereal, what a web page is posting so I can mimick the actions? Maybe some sort of firefox plugin? There is this javascript thing that happens then produces the page I want....maybe I''ll have to resort to ethereal.... Mike B. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
On Wed, Jan 20, 2010 at 1:14 PM, barsalou <barjunk at attglobal.net> wrote:> [...] > Is there a way to capture, besides ethereal, what a web page is posting so > I can mimick the actions? > [...] >I like Charles. http://www.charlesproxy.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20100120/b1d3a47b/attachment.html>