Node.js 带AWS Lambda的CasperJs
我使用创建casperjs,将phantomjs版本更新为2.1.1,并在Lambda上使用基本示例部署代码,这非常有效 但当我试图用亚马逊网站测试casperJs时,它没有起作用。页面未加载,但在本地,它的工作:Node.js 带AWS Lambda的CasperJs,node.js,amazon-web-services,phantomjs,casperjs,aws-lambda,Node.js,Amazon Web Services,Phantomjs,Casperjs,Aws Lambda,我使用创建casperjs,将phantomjs版本更新为2.1.1,并在Lambda上使用基本示例部署代码,这非常有效 但当我试图用亚马逊网站测试casperJs时,它没有起作用。页面未加载,但在本地,它的工作: // Simple Javascript example var casper = require('casper').create(); casper.options.verbose = true; casper.options.logLevel ="debug"; caspe
// Simple Javascript example
var casper = require('casper').create();
casper.options.verbose = true;
casper.options.logLevel ="debug";
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10; rv:33.0) Gecko/20100101 Firefox/33.0');
var amazonProduct = 'https://www.amazon.fr/gp/product/B017DBB1S8';
console.log('Loading a web page: ' + amazonProduct);
// Ouvre la page produit
casper.start(amazonProduct, function()
{
this.echo('Page title is: ' + this.getTitle());
});
casper.run();
Cloud Watch调试模块为我提供:
Loading a web page: https://www.amazon.fr/gp/product/B017DBB1S8
2017-01-31T22:04:30.553Z
[36m[info][0m [phantom] Starting...
[36m[info][0m [phantom] Running suite: 2 steps
[32;1m[debug][0m [phantom] opening url: https://www.amazon.fr/gp/product/B017DBB1S8, HTTP GET
[32;1m[debug][0m [phantom] Navigation requested: url=https://www.amazon.fr/gp/product/B017DBB1S8, type=Other, willNavigate=true, isMainFrame=true
2017-01-31T22:04:31.190Z [32;1m[debug][0m [phantom] url changed to "https://www.amazon.fr/gp/product/B017DBB1S8"
2017-01-31T22:04:43.074Z [32;1m[debug][0m [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
END RequestId: 3b415fbd-e801-11e6-9736-75ef38e95128
Duration: 15001.48 ms Billed Duration: 15000 ms Memory Size: 128 MB Max Memory Used: 74 MB
我不理解这个问题(我也尝试过使用包中提供的phantomjs 1.9.8版,但我也有同样的问题)
谢谢,这只是个超时问题
我需要在“配置”>“高级设置”>“超时”中调整超时时间,以供参考。当我为亚马逊网站编写爬虫程序时,我刚刚发现亚马逊网站阻止了我的请求,所以我使用Tor动态切换IP。