无法在selinium web driver-firefox中进行全页屏幕截图

时间:2017-07-19 10:09:15

标签: node.js firefox screenshot

嘿,在selinium webdriver nodejs中获取全屏截图的命令是什么。

这是我的代码:

var webdriver = require('selenium-webdriver');
    By = require('selenium-webdriver').By;
    until = require('selenium-webdriver').untill;
    fs = require('fs');
    var chromedriver = require('chromedriver');
     firefox = require('selenium-webdriver/firefox');
     var Capabilities = require('selenium-webdriver/lib/capabilities').Capabilities;
        var capabilities = Capabilities.firefox();
        capabilities.set('marionette', true); 
    //driver = new FirefoxDriver();

var driver = new webdriver.Builder().withCapabilities(capabilities).build();

driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get('http://iolearn.com');

driver.takeScreenshot().then(function(data){
    fs.writeFileSync('img.png',data,'base64');
});
driver.quit(); 

0 个答案:

没有答案