Selenium: Not able to take complete page screenshot using aShot library

前端 未结 2 1655
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 05:16

Am trying to take the complete page screenshot both horizontally and vertically using Firefox gecko driver and aShot Library.

However, the results are n

2条回答
  •  一生所求
    2020-12-12 05:47

    Try:

    Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(ShootingStrategies.scaling(1.75f), 1000)).takeScreenshot(driver);
    

    where 1.75f is device pixel ratio (you can run window.devicePixelRatio; in browser console to find it). If it's still not capturing full screen, change it to 2f

提交回复
热议问题