Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Use Proxy API to interact with remote objects #338

Closed
brianmhunt opened this Issue Dec 27, 2012 · 2 comments

Comments

Projects
None yet
2 participants

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.

Owner

n1k0 commented Dec 27, 2012

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 Dec 27, 2012

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