• <i id='fZLLi'><tr id='fZLLi'><dt id='fZLLi'><q id='fZLLi'><span id='fZLLi'><b id='fZLLi'><form id='fZLLi'><ins id='fZLLi'></ins><ul id='fZLLi'></ul><sub id='fZLLi'></sub></form><legend id='fZLLi'></legend><bdo id='fZLLi'><pre id='fZLLi'><center id='fZLLi'></center></pre></bdo></b><th id='fZLLi'></th></span></q></dt></tr></i><div id='fZLLi'><tfoot id='fZLLi'></tfoot><dl id='fZLLi'><fieldset id='fZLLi'></fieldset></dl></div>

    <legend id='fZLLi'><style id='fZLLi'><dir id='fZLLi'><q id='fZLLi'></q></dir></style></legend>

        <bdo id='fZLLi'></bdo><ul id='fZLLi'></ul>

        <small id='fZLLi'></small><noframes id='fZLLi'>

      1. <tfoot id='fZLLi'></tfoot>

        Selenium:无法使用 aShot 库获取完整的页面截图

        时间:2023-09-28

          <bdo id='mnoHO'></bdo><ul id='mnoHO'></ul>
            <tbody id='mnoHO'></tbody>

          • <small id='mnoHO'></small><noframes id='mnoHO'>

              1. <tfoot id='mnoHO'></tfoot>
              2. <legend id='mnoHO'><style id='mnoHO'><dir id='mnoHO'><q id='mnoHO'></q></dir></style></legend>

                  <i id='mnoHO'><tr id='mnoHO'><dt id='mnoHO'><q id='mnoHO'><span id='mnoHO'><b id='mnoHO'><form id='mnoHO'><ins id='mnoHO'></ins><ul id='mnoHO'></ul><sub id='mnoHO'></sub></form><legend id='mnoHO'></legend><bdo id='mnoHO'><pre id='mnoHO'><center id='mnoHO'></center></pre></bdo></b><th id='mnoHO'></th></span></q></dt></tr></i><div id='mnoHO'><tfoot id='mnoHO'></tfoot><dl id='mnoHO'><fieldset id='mnoHO'></fieldset></dl></div>

                  本文介绍了Selenium:无法使用 aShot 库获取完整的页面截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 Firefox gecko 驱动程序和

                  driver.get("https://google.com");截图 fpScreenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver);ImageIO.write(fpScreenshot.getImage(),"JPEG",new File("FullPageScreenshot.jpg"));

                  查看了很多变体,但没有任何效果.有趣的是,当我尝试使用旧的 Firefox 版本(46)时,我可以在没有任何第三方库的情况下截取完整的屏幕截图.我正在尝试使用最新的 firefox 并拥有完整的屏幕截图功能.

                  有什么帮助吗?

                  解决方案

                  试试:

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

                  其中 1.75f 是设备像素比(您可以在浏览器控制台中运行 window.devicePixelRatio; 来找到它).如果仍然没有捕获全屏,请将其更改为 2f

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

                  However, the results are not as expected. Take a look:

                  driver.get("https://google.com");
                  
                  Screenshot fpScreenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver);
                  ImageIO.write(fpScreenshot.getImage(),"JPEG",new File("FullPageScreenshot.jpg"));
                  

                  Looked into a lot of variants but nothing is working. Interestingly, when I try using old firefox version (46), I am able to take full screenshot without any third party library. Am trying to use latest firefox and have full screenshot functionality.

                  Any help?

                  解决方案

                  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

                  这篇关于Selenium:无法使用 aShot 库获取完整的页面截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:SessionNotCreatedException:会话未创建:此版本的 Chrom 下一篇:NoSuchMethodError: com.google.common.base.Preconditions.check

                  相关文章

                  最新文章

                  <tfoot id='kNJ3g'></tfoot>
                1. <small id='kNJ3g'></small><noframes id='kNJ3g'>

                2. <legend id='kNJ3g'><style id='kNJ3g'><dir id='kNJ3g'><q id='kNJ3g'></q></dir></style></legend>

                  1. <i id='kNJ3g'><tr id='kNJ3g'><dt id='kNJ3g'><q id='kNJ3g'><span id='kNJ3g'><b id='kNJ3g'><form id='kNJ3g'><ins id='kNJ3g'></ins><ul id='kNJ3g'></ul><sub id='kNJ3g'></sub></form><legend id='kNJ3g'></legend><bdo id='kNJ3g'><pre id='kNJ3g'><center id='kNJ3g'></center></pre></bdo></b><th id='kNJ3g'></th></span></q></dt></tr></i><div id='kNJ3g'><tfoot id='kNJ3g'></tfoot><dl id='kNJ3g'><fieldset id='kNJ3g'></fieldset></dl></div>
                    • <bdo id='kNJ3g'></bdo><ul id='kNJ3g'></ul>