【发布时间】:2017-12-15 02:33:54
【问题描述】:
我尝试使用这种方法动态修改代理:
console.log('before set proxy: '+Date());
casper.then(function(){
phantom.setProxy('127.0.0.1',"1080","manual",'','');
})
this.then(function(){
console.log('after set proxy: '+Date());
})
但是,phantom.setProxy 每次花费 6 分钟:
before set proxy: Fri Dec 15 2017 09:56:41 GMT+0800 (CST)
[warning] [phantom] Loading resource failed with status=fail:
https://chrome.google.com/webstore/category/extensions?utm_source=chrome-ntp-icon
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/7: done in 360210ms.
[info] [phantom] Step anonymous 3/7: done in 360230ms.
after set proxy: Fri Dec 15 2017 10:02:31 GMT+0800 (CST)
这种用法有什么问题?
而且其实phantom.setProxy('127.0.0.1',"1080","manual",'','')没有效果,但是phantom.setProxy('127.0.0.1',"1080","socks5",'','')是有效的。
【问题讨论】:
标签: javascript casperjs