Reputation: 207
Can CasperJS (with phantomJS) be run directly in the browser and not via the command line ?
I would like to run an interactive test from the browser where i take inputs from the user and proceed accordingly. I would like to run casperJS as a normal javascript function which is executed in a browser and be able to produce the output of each command to the user, such that the user can decide what he wants to do next.
Upvotes: 3
Views: 2043
Reputation: 55688
The short answer is: No, not as you've described it. CasperJS runs on, and depends on, PhantomJS, which is a browser - it can't run in a user's browser.
If you want to offer an interactive CasperJS session through a webpage, you'd need to run Casper/Phantom on a server, and then proxy the input/ouput through that server. Basically any operation that requires fetching other webpages and scraping or interacting with them is likely to require a server-side mechanism, because the Same Origin Policy makes this quite difficult to implement using client-side JavaScript (though a browser extension might be able to do it).
Upvotes: 4