简体   繁体   中英

PhantomJSDriver take screenshot after X seconds?

I was using PhantomJSDriver to take screenshots of many urls.

The problem was that timeout occurs for some of urls. I examined those urls which have failed, and I realize those url takes long time for them to be 'fully' loaded.

I can't just extend pageLoadTimeout because it will take too much time to process all the urls. So, I would rather make PhantomJSDriver to not wait until the page is fully loaded.

Would it be possible for PhantomJSDriver to take screenshot after X seconds, whether it's fully loaded or not?

Thanks

You can pause the execution of the running thread for sometime after url navigation and then take the screenshot.

driver.Navigate().GoToUrl(url);
Thread.Sleep(1000); // 1000 milli seconds
driver.GetScreenshot()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM