could you tell me please how do I inject js into a page with CasperJS?
I want this after page has been loaded:
- inject
alert(Hello, World!')or/and - inject
window.location=stackoverflow.commake screenshot.
Pretty simple.
could you tell me please how do I inject js into a page with CasperJS?
I want this after page has been loaded:
alert(Hello, World!') or/andwindow.location=stackoverflow.com
make screenshot.Pretty simple.
Copyright © 2021 Jogjafile Inc.
To switch context from Casper's one to browser simply call casper's
evaluatemethod. It enables to evaluate your code in Browser context.So calling alert should look something like this:
You can read documentation for evaluate method here
As this answers both of your questions I would just like you to know that navigating to other web can be more easily done with Casper
openmethod as your code will be much easier to read and maintain.