我尝试测试需要java插件的网站。
使用此代码
casper.test.comment('-> Loading page');
casper.start('http://localhost:8080', function() {
casper.test.comment('-> Capture : homeURL loaded.png');
casper.capture('homeURL loaded.png');
});
casper.run(function(){
this.test.done();
});
我有一个捕获显示没有加载java插件。
如何加载?
我也试过这个也行不通:
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
pageSettings: {
loadImages: true, // The WebPage instance used by Casper will
loadPlugins: true // use these settings
}
})
casper.test.comment('-> Loading page');
casper.start('http://localhost:8080', function() {
casper.test.comment('-> Capture : homeURL loaded.png');
casper.capture('homeURL loaded.png');
});
casper.run(function(){
this.test.done();
casper.exit();
});
祝你好运, 克里斯
答案 0 :(得分:0)
我确实使用了这个,只是将网址更改为google.com。
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
pageSettings: {
loadImages: true, // The WebPage instance used by Casper will
loadPlugins: true // use these settings
}
})
casper.test.comment('-> Loading page');
casper.start('http://google.com', function() {
casper.test.comment('-> Capture : homeURL loaded.png');
casper.capture('homeURL loaded.png');
});
casper.run(function(){
this.test.done();
casper.exit();
});
It ran for me ...This is what I got back
C:\Examples>casperjs test load.js
Test file: load.js
# -> Loading page
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: http://google.com/, HTTP GET
[debug] [phantom] Navigation requested: url=http://google.com/, type=Other, will
Navigate=true, isMainFrame=true
[debug] [phantom] url changed to "http://google.com/"
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/2 http://google.com/ (HTTP 407)
# -> Capture : homeURL loaded.png
[debug] [phantom] Capturing page to C:/Examples/homeURL loaded.png
[info] [phantom] Capture saved to C:/Examples/homeURL loaded.png
[info] [phantom] Step anonymous 2/2: done in 242ms.
[info] [phantom] Done 2 steps in 245ms.