On December 9, 2015 at 9:08:22 AM, Tim Scott (tsc...@lunaversesoftware.com) wrote:
Edit to my second example:casper.thenOpen casper.cli.get(’some_url’),data = null@waitFor ->trydata = JSON.parse @getPageContent()data.someExpectedElelment != nullcatchfalse, ->#do stuff with dataOn December 9, 2015 at 9:06:28 AM, Tim Scott (tsc...@lunaversesoftware.com) wrote:
Richard,In my experience, casperjs handles this well synchronously. Whenever I get json, my code looks like this (in coffeescript):casper.thenOpen casper.cli.get(’some_url’), ->data = JSON.parse @getPageContent()# do stuff with dataUnless you need to wait for things async to the main request to happen, such as client side rendering or secondary resource requests, waiting should not be necessary in my experience.However, you could do something like this:data = nullcasper.thenOpen casper.cli.get(’some_url’),@waitFor ->trydata = JSON.parse @getPageContent()data.someExpectedElelment != nullcatchfalse, ->#do stuff with data--
Tim ScottP.S. I know a guy named Lando B who knows a Robert Poor. Is that you?
--
CasperJS homepage & documentation: http://casperjs.org/
CasperJS @github: https://github.com/n1k0/casperjs
You received this message because you are subscribed to the Google Groups "casperjs" group.
Visit this group at http://groups.google.com/group/casperjs?hl=en.
---
You received this message because you are subscribed to the Google Groups "CasperJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casperjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.