0

スクリーンショットを撮ろうとしている URL はhttps://www.smashingmagazine.com/2017/05/long-scrolling/ 添付は Ashot から取得したスクリーンショットです。[ashot のスクリーンショット] - https://i.stack.imgur.com/CdeYf.jpg (不完全であることに注意してください)

バグではなくメモリの問題だと思います。任意のポインタをいただければ幸いです。

これは、スクリーンショットを撮るために使用しているコードです。

import java.io.File;
import javax.imageio.ImageIO;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import ru.yandex.qatools.ashot.AShot;
import ru.yandex.qatools.ashot.Screenshot;
import ru.yandex.qatools.ashot.shooting.ShootingStrategies;

public class ashot_CompletePage {

    public static void main(String[] args) throws Exception {

        System.setProperty("god.bless.you", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("start-maximized");
        options.addArguments("disable-infobars");
        options.addArguments("--disable-extensions"); 
        WebDriver driver =  new ChromeDriver(options);
        driver.get("https://www.smashingmagazine.com/2017/05/long-scrolling/");
        new WebDriverWait(driver, 20).until(ExpectedConditions.titleContains("jQuery"));
        Screenshot myScreenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(100)).takeScreenshot(driver);
        ImageIO.write(myScreenshot.getImage(),"PNG",new File("./Screenshots/elementScreenshot.png"));
        driver.quit();
    }
}
4

0 に答える 0