Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Use Proxy API to interact with remote objects #338

Closed
brianmhunt opened this Issue · 2 comments

2 participants

@brianmhunt

Proxies would be an intuitive yet straightforward addition to CasperJS to access remote objects, via the Proxy API aka direct proxies.

Proxies are awesome. One example would be to define casper.$ that acts as a proxy for the remote jQuery object so one could do something like this:

casper.$("ul.menu li").each(function (el) { casper.$(el).addClass("marked") });

And it will do what you expect on the remote headless browser. The details of an implementation are fairly straightforward, with basically every call to the local proxy object acting as a wrapper through casper.evaluate. However a suggested API is a bit premature since the Proxy API has not been widely adopted. In particular it won't be in PhantomJS until it supports V8 or WebKit gets support for Harmony extensions to ES5. It's coming though. :)

All that being said, a Proxy implementation may be outside the scope of this project. Nevertheless, I thought it was interesting enough to mention.

@n1k0
Owner

Just for letting me know about this feature, thank you: it's awesome indeed! Though I don't really know what to do with this issue right now :) Well I'm gonna close it to keep a bit of visibility about what's actually in the pipe

I think the ML is a better place than issues for discussing about this ;)

@n1k0 n1k0 closed this
@brianmhunt

Thanks @n1k0 -- the ML didn't occur to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.