Headless browser, incomplete screenshots

   The requirement of some projects is to generate report information regularly. 
   One is to archive the information of the current page and store it on the server. The other is to process it through template parsing. No matter which method is used, it is not easy. Next, we conducted technical research, and finally used a headless browser (selenium) to take screenshots based on business needs;

        During the use, I encountered the need to intercept a long picture, but the interception was always incomplete.

        

        solution:

                   

        ChromeOptions options = new ChromeOptions(); 
        //Set chrome's headless mode 
         options.addArguments("--headless"); 
and then use
File scrFile = element.getScreenshotAs(OutputType.FILE); intercept and it’s ok

    

   

Guess you like

Origin blog.csdn.net/y15201653575/article/details/119934778