Javascript 在CasperJS中以这种方式动态更改代理是否正确?
我尝试使用以下方法动态修改代理:Javascript 在CasperJS中以这种方式动态更改代理是否正确?,javascript,casperjs,Javascript,Casperjs,我尝试使用以下方法动态修改代理: 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 s
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','','','')
是有效的。这可能太晚了,无法回答,但我们来了
我在PhantomJS网站上没有看到任何引用,但在SlimerJS文档页面>>
代理类型:
-“系统”:使用系统代理设置
-“自动”:自动检测代理设置
-“配置url”:自动代理配置url
-“袜子”-“袜子5”
-“http”
-/null/未定义
答案是,“手动”不是可能的选项之一,您可以使用“http”