I'trying to change Javascript src in order to get a "dev environment" for testing some Javascripts.
( Obviously i can't build a real dev environment , i can't mirror this website on a dev env ).
So i was thinking about manipulating Dom with PhantomJS and testing javascript with CasperJS. I wanna convert ( for example ) this script
<script type="..." language="..." src="production_path/source.js"></script>
into this one
<script type="..." language="..." src="dev_path/source.js"></script>
before the script starts loading.
I'm trying with
casper.start("http://www.example.com/",function(status){
var scripts = document.getElementsByTagName('script');
casper.each(scripts,function(self,my_script){
//here i would rewrite script url
});
});
casper.run();
but it doesn't work. I'm afraid i have to wait for something , but i'm not understanding what.