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 directs the test to a particular address. Everytime an environment changed or the target location changed, we would need to update this variable.
To avoid having to update the files, I'd like to pass the values through the command line, as to where to test this.
Is there a way to declare the string variable through the cmd as you run the file?
E.g.:
casperjs test.js "var site='http://google.com';"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…