I\'m using PhantomJs, CasperJs, and Js in a js file ran through the cmd.
Imagine we had two files(test1.js, and test2.js). Both files have a url/site variable that d
You could have one file with your global variables, then call them in the other files. Like that when you want to modify one variable, you have only one file to modify. Use phantom.injectJs(path/to/file) to call other files in your main files. It Works with phantomJS and slimerJS.
Example :
js_file
--variable.js--
var site='http://google.com';
js_file
--file1.js--
phantom.injectJs( 'variable.js');
casper.start(site, function(){
...
});
js_file
--file2.js--
phantom.injectJs( 'variable.js');
casper.thenOpen(site, function(){
...
});