From dradetsky at gmail.com Tue Jul 7 01:41:30 2009 From: dradetsky at gmail.com (Daniel Radetsky) Date: Mon, 6 Jul 2009 22:41:30 -0700 Subject: [Celerity-users] Celerity::Image#loaded? is incorrect (I think) Message-ID: <20090706224130.24d7c9f9@drad> Folks: Been doing some work with Celerity/HtmlUnit recently. I noticed that the function 'Celerity::Image#loaded?', which I assume is supposed to do nothing but determine if the image has already been loaded, does not do that. What it does is attempt to download the image, and returns false if it fails to do so. This is because (if I understand correctly) HtmlUnit does not by default download images (for performance reasons). It only downloads them if they have an onload handler. Ordinarily the function will call its way down to downloadImageIfNeeded, and then download the image. Or maybe I'm wrong. It's happened before. If I'm right, another option would be to call getWebResponse(false) (i.e. don't actually try to fill the web response object if it's empty) and check for null. --Daniel From jari.bakken at gmail.com Thu Jul 16 10:48:59 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Thu, 16 Jul 2009 16:48:59 +0200 Subject: [Celerity-users] Issue with setTimeout and window.location In-Reply-To: <2ED01B80-77C1-4291-99E7-0F41D0C24B89@cllearview.com> References: <2ED01B80-77C1-4291-99E7-0F41D0C24B89@cllearview.com> Message-ID: <02B696C1-365F-4BD9-9CB7-1E7AE3C7D0B8@gmail.com> On 16. juli. 2009, at 16.36, Andy Shipman wrote: > I've been trying to use Celerity to test an automatic redirect after > a timeout. However, when the timeout kicks in then the page does not > appear to redirect, but stays as the previous page. > This seems to be a bug in Celerity. Please open an issue on GitHub (http://github.com/jarib/celerity/issues ) and I'll dig into it as soon as I can. As a temporary workaround you can do this to manually "refresh" the page: browser.send :refresh_page_from_window From ashley.moran at patchspace.co.uk Thu Jul 16 10:51:45 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Thu, 16 Jul 2009 15:51:45 +0100 Subject: [Celerity-users] Issue with setTimeout and window.location In-Reply-To: <2ED01B80-77C1-4291-99E7-0F41D0C24B89@cllearview.com> References: <2ED01B80-77C1-4291-99E7-0F41D0C24B89@cllearview.com> Message-ID: On 16 Jul 2009, at 15:36, Andy Shipman wrote: > It does, however, report: > com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify Running a very slightly modified version of the file (against the same HTML): require 'rubygems' gem 'jarib-celerity' require 'celerity' browser = Celerity::Browser.new browser.goto("file://#{File.expand_path(File.dirname(__FILE__))}/ timeout.html") puts browser.url sleep(4) puts browser.url if browser.text.include?("Search") puts "yay" else puts browser.text end I get: 24> ~/Desktop/celerity % jruby test_timeout.rb file:/Users/ashleymoran/Desktop/celerity/timeout.html 16-Jul-2009 15:47:18 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Obsolete content type encountered: 'text/javascript'. file:/Users/ashleymoran/Desktop/celerity/timeout.html Timeout test Wait 3 seconds then you'll see Google. It looks like the new page is being loaded, but Celerity is not updating the browser. Unfortunately, because of the URL not being set, you can't use Browser#refresh to trick it into reloading. Seems like a bug to me. If so, is there a way of working around it? Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ http://twitter.com/ashleymoran From andy at cllearview.com Thu Jul 16 11:29:08 2009 From: andy at cllearview.com (Andy Shipman) Date: Thu, 16 Jul 2009 16:29:08 +0100 Subject: [Celerity-users] Issue with setTimeout and window.location In-Reply-To: <02B696C1-365F-4BD9-9CB7-1E7AE3C7D0B8@gmail.com> References: <2ED01B80-77C1-4291-99E7-0F41D0C24B89@cllearview.com> <02B696C1-365F-4BD9-9CB7-1E7AE3C7D0B8@gmail.com> Message-ID: <8B455116-BECD-4AF0-8B60-1AE8D4E4DC2F@cllearview.com> > This seems to be a bug in Celerity. Please open an issue on GitHub (http://github.com/jarib/celerity/issues > ) and I'll dig into it as soon as I can. > As a temporary workaround you can do this to manually "refresh" the > page: > > browser.send :refresh_page_from_window Done at http://github.com/jarib/celerity/issues/#issue/2. Thanks for the workaround! Andy o-- CLLEARVIEW From ashley.moran at patchspace.co.uk Sat Jul 18 16:18:23 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Sat, 18 Jul 2009 21:18:23 +0100 Subject: [Celerity-users] Silencing a specific SEVERE warning from Dojo Message-ID: <93BD5484-EBEF-48D8-9FD4-08A4D2EB1896@patchspace.co.uk> Hi I'm being bugged lately by a warning from the Dojo library. The following script is enough to trigger it, but also generates a few unrelated warnings: require 'rubygems' gem 'jarib-celerity' require 'celerity' browser = Celerity::Browser.new browser.goto("http://dojotoolkit.org/") The one that is causing a problem is: SEVERE: runtimeError: message=[document.execCommand(): invalid command 'BackgroundImageCache'] sourceName=[http://dojotoolkit.org/sites/all/modules/dojo/dtk_build/dojo/dojo.js ] line=[20] lineSource=[null] lineOffset=[0] This is caused by the following code in Dojo (if you use dojo.js.uncompressed.js): try{ document.execCommand("BackgroundImageCache", false, true); }catch(e){ // sane browsers don't have cache "issues" } Now, the whole thing is wrapped in an exception block, which means I wouldn't expect to see any error reporting. (Clearly, it's logging anyway.) The implication is, I guess, that HtmlUnit is not "sane". Is there a way round this? Because of the unfortunate SEVERE log level, we've been forced to disable all JavaScript error reporting, or suffer this several hundred times during a Cucumber feature run. Workarounds/other feedback much appreciated. Thanks Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From jari.bakken at gmail.com Sun Jul 19 07:28:19 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Sun, 19 Jul 2009 13:28:19 +0200 Subject: [Celerity-users] Silencing a specific SEVERE warning from Dojo In-Reply-To: <93BD5484-EBEF-48D8-9FD4-08A4D2EB1896@patchspace.co.uk> References: <93BD5484-EBEF-48D8-9FD4-08A4D2EB1896@patchspace.co.uk> Message-ID: Hello Ashley, On 18. juli. 2009, at 22.18, Ashley Moran wrote: > > Now, the whole thing is wrapped in an exception block, which means I > wouldn't expect to see any error reporting. (Clearly, it's logging > anyway.) The implication is, I guess, that HtmlUnit is not "sane". > > Is there a way round this? Because of the unfortunate SEVERE log > level, we've been forced to disable all JavaScript error reporting, > or suffer this several hundred times during a Cucumber feature run. > > Workarounds/other feedback much appreciated. You should definitely post this to the HtmlUnit list. Hopefully HtmlUnit can become "sane". Workarounds: 1. Switch to another browser type (I only see the SEVERE error with Firefox 2, which is the default) Celerity::Browser.new(:browser => :firefox3) 2. Turn off logging for the whole JavaScriptEngine class Celerity ::Util .logger_for ("com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine").level = java.util.logging.Level::OFF From ashley.moran at patchspace.co.uk Sun Jul 19 08:04:40 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Sun, 19 Jul 2009 13:04:40 +0100 Subject: [Celerity-users] Silencing a specific SEVERE warning from Dojo In-Reply-To: References: <93BD5484-EBEF-48D8-9FD4-08A4D2EB1896@patchspace.co.uk> Message-ID: <1E1C9C23-4418-4C39-BC4A-41FB189982B3@patchspace.co.uk> On 19 Jul 2009, at 12:28, Jari Bakken wrote: > You should definitely post this to the HtmlUnit list. Hopefully > HtmlUnit can become "sane". I will do just this. > Workarounds: > > 1. Switch to another browser type (I only see the SEVERE error with > Firefox 2, which is the default) > > Celerity::Browser.new(:browser => :firefox3) Thanks! I like this solution best, gets rid of the only Dojo warning I can't do anything about. Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From ashley.moran at patchspace.co.uk Sun Jul 19 08:17:31 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Sun, 19 Jul 2009 13:17:31 +0100 Subject: [Celerity-users] Silencing a specific SEVERE warning from Dojo In-Reply-To: References: <93BD5484-EBEF-48D8-9FD4-08A4D2EB1896@patchspace.co.uk> Message-ID: <4C4099B9-2338-4909-8FF7-0BD6FC764C00@patchspace.co.uk> On 19 Jul 2009, at 12:28, Jari Bakken wrote: > You should definitely post this to the HtmlUnit list. Hopefully > HtmlUnit can become "sane". FYI, here is the ticket: https://sourceforge.net/tracker/?func=detail&aid=2823863&group_id=47038&atid=448266 Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From ashley.moran at patchspace.co.uk Mon Jul 27 12:43:27 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Mon, 27 Jul 2009 17:43:27 +0100 Subject: [Celerity-users] Browser history Message-ID: <3F8D2D2C-0BB1-421F-B10F-4E55C1528E97@patchspace.co.uk> Hi Recently hit the need to invistigate the behaviour of the Back button. This is when we discovered Celerity only has one level of history. (And also, it behaves different from Firefox, which uses a page cache when clicking back.) Has anyone else run into this limitation and wished the history was more sophisticated. Is it a Celerity issue, or should I file a ticket direct with HtmlUnit? Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From ashley.moran at patchspace.co.uk Mon Jul 27 12:44:58 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Mon, 27 Jul 2009 17:44:58 +0100 Subject: [Celerity-users] CSS Message-ID: <16BC9CCB-99FC-41F2-B9DD-F5EA209BC920@patchspace.co.uk> Hi I tried experimenting with Celerity/HtmlUnit's CSS support recently. I was hoping it would respect `display: none` but it doesn't eliminate text from Browser#text. What is the extent of CSS support? What can and can't you do with it. I can't find any documentation. Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From jari.bakken at gmail.com Mon Jul 27 18:49:57 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Tue, 28 Jul 2009 00:49:57 +0200 Subject: [Celerity-users] Browser history In-Reply-To: <3F8D2D2C-0BB1-421F-B10F-4E55C1528E97@patchspace.co.uk> References: <3F8D2D2C-0BB1-421F-B10F-4E55C1528E97@patchspace.co.uk> Message-ID: > > > Is it a Celerity issue, or should I file a ticket direct with HtmlUnit? > This was recently added to HtmlUnit - I've just pushed a commit that makes Celerity use it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jari.bakken at gmail.com Mon Jul 27 19:05:05 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Tue, 28 Jul 2009 01:05:05 +0200 Subject: [Celerity-users] CSS In-Reply-To: <16BC9CCB-99FC-41F2-B9DD-F5EA209BC920@patchspace.co.uk> References: <16BC9CCB-99FC-41F2-B9DD-F5EA209BC920@patchspace.co.uk> Message-ID: On Mon, Jul 27, 2009 at 6:44 PM, Ashley Moran wrote: > > I tried experimenting with Celerity/HtmlUnit's CSS support recently. I was > hoping it would respect `display: none` but it doesn't eliminate text from > Browser#text. > > What is the extent of CSS support? What can and can't you do with it. I > can't find any documentation. > Seems to works for me: http://gist.github.com/156811 Do you have some example HTML where this doesn't work? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashley.moran at patchspace.co.uk Mon Jul 27 19:56:09 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Tue, 28 Jul 2009 00:56:09 +0100 Subject: [Celerity-users] Browser history In-Reply-To: References: <3F8D2D2C-0BB1-421F-B10F-4E55C1528E97@patchspace.co.uk> Message-ID: On 27 Jul 2009, at 23:49, Jari Bakken wrote: > This was recently added to HtmlUnit - I've just pushed a commit that > makes Celerity use it. Thanks Jari! Is it a Github gem now? Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From jari.bakken at gmail.com Mon Jul 27 22:34:03 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Tue, 28 Jul 2009 04:34:03 +0200 Subject: [Celerity-users] Browser history In-Reply-To: References: <3F8D2D2C-0BB1-421F-B10F-4E55C1528E97@patchspace.co.uk> Message-ID: On Tue, Jul 28, 2009 at 1:56 AM, Ashley Moran wrote: > > Thanks Jari! Is it a Github gem now? > I've pushed a new gemspec as well, so version 0.0.6.12 should be available from GitHub any minute now. (Please note that this version includes a HtmlUnit snapshot that contains a really annoying bug [1].) [1] http://sourceforge.net/tracker/?func=detail&aid=2824922&group_id=47038&atid=448266 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashley.moran at patchspace.co.uk Tue Jul 28 14:00:17 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Tue, 28 Jul 2009 19:00:17 +0100 Subject: [Celerity-users] Browser history In-Reply-To: References: <3F8D2D2C-0BB1-421F-B10F-4E55C1528E97@patchspace.co.uk> Message-ID: On 28 Jul 2009, at 03:34, Jari Bakken wrote: > I've pushed a new gemspec as well, so version 0.0.6.12 should be > available from GitHub any minute now. (Please note that this version > includes a HtmlUnit snapshot that contains a really annoying bug [1].) Thanks Jari - saw this today and it's working as you'd expect. Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From ashley.moran at patchspace.co.uk Wed Jul 29 10:58:16 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Wed, 29 Jul 2009 15:58:16 +0100 Subject: [Celerity-users] Loading Dojo from Google CDN Message-ID: Hi We've been using Dojo, and for a while we were serving the JavaScript locally. We switched to using the Google CDN, but since then some of our Cucumber features started breaking. These are ones that have `dojo.require` and `dojo.addOnLoad` calls. I'm pretty sure it's because using the Google CDN means you have to use the cross-domain loader, which is asynchronous. Using `Browser#wait` fixes the features, but means we have to litter them with 'And I wait for JavaScript actions to complete', and it makes it really slow. Is there a good way round this asynchronous loading issue? Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From jari.bakken at gmail.com Wed Jul 29 12:36:28 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Wed, 29 Jul 2009 18:36:28 +0200 Subject: [Celerity-users] Loading Dojo from Google CDN In-Reply-To: References: Message-ID: On Wed, Jul 29, 2009 at 4:58 PM, Ashley Moran wrote: > > Is there a good way round this asynchronous loading issue? > Have you tried :resynchronize => true? See http://wiki.github.com/jarib/celerity/ajax for details. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashley.moran at patchspace.co.uk Wed Jul 29 13:31:52 2009 From: ashley.moran at patchspace.co.uk (Ashley Moran) Date: Wed, 29 Jul 2009 18:31:52 +0100 Subject: [Celerity-users] Loading Dojo from Google CDN In-Reply-To: References: Message-ID: On 29 Jul 2009, at 17:36, Jari Bakken wrote: > On Wed, Jul 29, 2009 at 4:58 PM, Ashley Moran > wrote: > > Is there a good way round this asynchronous loading issue? > > Have you tried :resynchronize => true? See http://wiki.github.com/jarib/celerity/ajax > for details. Hi Jari Yes, we already use that. Unfortunately, because it's not a user- invoked JavaScript thread (it's on the page load), you have to wait on it separately. Any other ideas? I'm at a loss... Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ From jari.bakken at gmail.com Thu Jul 30 10:32:00 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Thu, 30 Jul 2009 16:32:00 +0200 Subject: [Celerity-users] Loading Dojo from Google CDN In-Reply-To: References: Message-ID: On Wed, Jul 29, 2009 at 7:31 PM, Ashley Moran wrote: > > On 29 Jul 2009, at 17:36, Jari Bakken wrote: > > On Wed, Jul 29, 2009 at 4:58 PM, Ashley Moran < >> ashley.moran at patchspace.co.uk> wrote: >> >> Is there a good way round this asynchronous loading issue? >> >> Have you tried :resynchronize => true? See >> http://wiki.github.com/jarib/celerity/ajax for details. >> > > > Hi Jari > > Yes, we already use that. Unfortunately, because it's not a user-invoked > JavaScript thread (it's on the page load), you have to wait on it > separately. > > Any other ideas? I'm at a loss... > > Ideas: 1. Subclass com.gargoylesoftware.htmlunit.AjaxController and make it synchronize requests that matches your criteria. 2. Use Browser#add_checker to call #wait after page loads (perhaps checking a list of URLs to see if it's needed) 3. Write to the HtmlUnit list and ask for better ideas :) The best solution is probably #1, here's an example how it might look (untested): http://gist.github.com/158714 (Perhaps we should add something to Celerity that does this for you - let the user provide a lambda that will decide whether or not to process the call synchronously. API suggestions welcome!) jb -------------- next part -------------- An HTML attachment was scrubbed... URL: From jari.bakken at gmail.com Thu Jul 30 10:42:32 2009 From: jari.bakken at gmail.com (Jari Bakken) Date: Thu, 30 Jul 2009 16:42:32 +0200 Subject: [Celerity-users] Loading Dojo from Google CDN In-Reply-To: References: Message-ID: PS. If you're using :resynchronize => true already, you should subclass com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController instead. -------------- next part -------------- An HTML attachment was scrubbed... URL: