From peter at hexagile.com Fri Dec 3 13:11:46 2010 From: peter at hexagile.com (Peter Szinek) Date: Fri, 3 Dec 2010 19:11:46 +0100 Subject: [Celerity-users] POST request? Message-ID: Hey all, I'd like to send a POST request without submitting a form (so just something like page.doPost(url, params). 1) Is this possible w/ celerity (I know it is w/ HTMLUnit) 2) If it is not, is it accessible through HTMLUnit somehow? Cheers, Peter From jari.bakken at gmail.com Fri Dec 3 13:40:40 2010 From: jari.bakken at gmail.com (Jari Bakken) Date: Fri, 3 Dec 2010 19:40:40 +0100 Subject: [Celerity-users] POST request? In-Reply-To: References: Message-ID: <7900827387096255155@unknownmsgid> Den 3. des. 2010 kl. 19:28 skrev Peter Szinek : > Hey all, > > I'd like to send a POST request without submitting a form (so just > something like page.doPost(url, params). > > 1) Is this possible w/ celerity (I know it is w/ HTMLUnit) There's no API in Celerity to do this. How is it possible in HtmlUnit? > 2) If it is not, is it accessible through HTMLUnit somehow? > You can get a WebClient instance by doing: Celerity::Browser.new.webclient > Cheers, > Peter > _______________________________________________ > Celerity-users mailing list > Celerity-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/celerity-users From peter at hexagile.com Fri Dec 3 14:31:22 2010 From: peter at hexagile.com (Peter Szinek) Date: Fri, 3 Dec 2010 20:31:22 +0100 Subject: [Celerity-users] POST request? In-Reply-To: <7900827387096255155@unknownmsgid> References: <7900827387096255155@unknownmsgid> Message-ID: > > There's no API in Celerity to do this. How is it possible in HtmlUnit? Never tried, but http://colinhowe.wordpress.com/2009/06/24/htmlunit-how-to-do-a-post/ >> 2) If it is not, is it accessible through HTMLUnit somehow? >> > > You can get a WebClient instance by doing: > > Celerity::Browser.new.webclient Cheers! P From peter at hexagile.com Fri Dec 3 14:49:15 2010 From: peter at hexagile.com (Peter Szinek) Date: Fri, 3 Dec 2010 20:49:15 +0100 Subject: [Celerity-users] POST request? In-Reply-To: References: <7900827387096255155@unknownmsgid> Message-ID: Umm... where do I get a WebRequestSettings object from? On Fri, Dec 3, 2010 at 8:31 PM, Peter Szinek wrote: >> >> There's no API in Celerity to do this. How is it possible in HtmlUnit? > > Never tried, but > > http://colinhowe.wordpress.com/2009/06/24/htmlunit-how-to-do-a-post/ > >>> 2) If it is not, is it accessible through HTMLUnit somehow? >>> >> >> You can get a WebClient instance by doing: >> >> Celerity::Browser.new.webclienUt > > Cheers! > P > From jari.bakken at gmail.com Fri Dec 3 16:13:21 2010 From: jari.bakken at gmail.com (Jari Bakken) Date: Fri, 3 Dec 2010 22:13:21 +0100 Subject: [Celerity-users] POST request? In-Reply-To: References: <7900827387096255155@unknownmsgid> Message-ID: On Fri, Dec 3, 2010 at 8:49 PM, Peter Szinek wrote: > Umm... where do I get a WebRequestSettings object from? > Celerity includes the com.gargoylesoftware.htmlunit package in the HtmlUnit module, so you can get the class as HtmlUnit::WebRequestSettings, or reference it directly as com.gargoylesoftware.htmlunit.WebRequestSettings. I suggest you use Celerity's source code and the JRuby wiki to understand how JRuby's Java integration works. The comment by Ahmed on the blog you linked is very much true though - you're using HtmlUnit (and Celerity) for something it wasn't intended to do. Why do you need to make a custom POST request through a browser simulator? Why can't you use a regular HTTP library (like RestClient or just pure Net::HTTP)? From peter at hexagile.com Tue Dec 7 03:34:09 2010 From: peter at hexagile.com (Peter Szinek) Date: Tue, 7 Dec 2010 09:34:09 +0100 Subject: [Celerity-users] POST request? In-Reply-To: References: <7900827387096255155@unknownmsgid> Message-ID: Because I found the pseudo-silver bullet: celerity - scRUBYt!'s new version, used in heavy production environments by now is built solely on it. Before it was Mechanize+Nokogiri+FireWatir for JS+this and that, but since I need scrubyt to run on every kind of *nixes, amazon ec3 and whatnot, it was just a total pain in the ass to install/update/maintain all the patches I added to all these packages all the time. So I decided to turn celerity into an uber-scraping tool - yes, it's a frankenstein now, but at least it's 1 frankenstein, and not 5 separate ones running amok stamping on each other's feet all the time ;-) Thanks for bearing with me during the frankensteinization, your help is invaluable! Cheers, Peter On Fri, Dec 3, 2010 at 10:13 PM, Jari Bakken wrote: > On Fri, Dec 3, 2010 at 8:49 PM, Peter Szinek wrote: >> Umm... where do I get a WebRequestSettings object from? >> > > Celerity includes the com.gargoylesoftware.htmlunit package in the > HtmlUnit module, so you can get the class as > HtmlUnit::WebRequestSettings, or reference it directly as > com.gargoylesoftware.htmlunit.WebRequestSettings. I suggest you use > Celerity's source code and the JRuby wiki to understand how JRuby's > Java integration works. > > The comment by Ahmed on the blog you linked is very much true though - > you're using HtmlUnit (and Celerity) for something it wasn't intended > to do. Why do you need to make a custom POST request through a browser > simulator? Why can't you use a regular HTTP library (like RestClient > or just pure Net::HTTP)? > _______________________________________________ > Celerity-users mailing list > Celerity-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/celerity-users > From bkalthod at gmail.com Sat Dec 25 14:19:25 2010 From: bkalthod at gmail.com (BK) Date: Sat, 25 Dec 2010 14:19:25 -0500 Subject: [Celerity-users] Celerity Images Message-ID: Can Celerity handle images? When I try to navigate to a URL which is an image, I get the following error I'm actually testing that browsing to the image URL does not display a 404 message. I'm able to do the same using Watir. irb(main):006:0> b.goto("* http://myDomain.com/images/cover_images/1_110x150.jpg*") Celerity::Exception::UnexpectedPageException: image/jpeg from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/browser.rb:748:in `page=' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/browser.rb:784:in `enable_event_listener' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/listener.rb:120:in `call' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/listener.rb:120:in `webWindowClosed' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/listener.rb:120:in `each' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/listener.rb:120:in `webWindowClosed' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/browser.rb:100:in `goto' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/container.rb:796:in `rescue_status_code_exception' from c:/jruby-1.5.2/lib/ruby/gems/1.8/gems/celerity-0.8.6/lib/celerity/browser.rb:99:in `goto' from (irb):6 Thanks in Advance -B -------------- next part -------------- An HTML attachment was scrubbed... URL: