1

How to scroll a down a website and take screenshot using protractor.I have attached the code I have tried.enter image description here.I, able to take screenshot but not able to take full page.

function writeScreenShot(data: string, filename: string) {
    var stream = fs.createWriteStream(filename);
    stream.write(new Buffer(data, 'base64'));
    stream.end();
  }
 // var foo = element(by.id('foo'));
  
  //of element
  //foo.takeScreenshot().then((png) => {
    //writeScreenShot(png, 'foo.png');
  //});
  browser.executeScript('window.scrollTo(0,document.body.scrollHeight)');
  //of entire page in viewport
  browser.takeScreenshot().then((png) => {
    writeScreenShot(png, 'foo.png');
  }); 
siva
  • 31
  • 4
  • Does this answer your question? [How to take screenshot of entire page in Protractor?](https://stackoverflow.com/questions/31406884/how-to-take-screenshot-of-entire-page-in-protractor) – Ramesh Rajendran Apr 16 '21 at 05:34
  • @RameshRajendran no it doesnt .It just reduce the size of the browser,But my requirement is to scroll down and take full screenshot of the image.Note:the website contains only of image no webelement in it – siva Apr 16 '21 at 06:11

0 Answers0