捕獲和轉換Web的工具

如何在執行捕獲之前等待網頁加載?

主要內容之後加載的網頁上的項目

某些網頁可能需要一段時間才能加載或包含特定內容 int可能會在加載主頁後加載。 在通過JavaScript加載內容的AJAX繁重的網頁上尤其如此。

GrabzIt可以檢測到何時加載網頁,但是對於上面列出的某些特定情況,它需要一些其他說明,例如在捕獲之前應使用延遲的形式,或者通過等待指定的HTML元素在捕獲應該出現之前出現,來進行延遲先。 如果您要截取網頁的屏幕截圖或轉換HTML,則可以使用這些技術 into PDF,圖像或Word文檔,您將獲得一個高級軟件包。 儘管您可以通過我們的免費試用這些功能 七天免費試用.

這些功能也可以在我們的 在線截圖 - 刮板機 的工具。

如何在執行捕獲之前等待指定的時間?

只需指定延遲(以毫秒為單位),這就是捕獲將等待的時間。 請記住,一秒有1000毫秒。 以下所有示例在捕獲網頁之前等待三秒鐘。

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.Delay = 3000;
grabzIt.URLToImage("http://www.spacex.com", options);
grabzIt.SaveTo("images/result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.setDelay(3000);
grabzIt.URLToImage("http://www.spacex.com", options);
grabzIt.SaveTo("images/result.jpg");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.4.7/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.spacex.com", 
{"delay": 3000}).Create();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
var options = {"delay":"3000"};
client.url_to_image("http://www.spacex.com", options);
client.save_to("images/result.jpg", function (error, id){
    if (error != null){
        throw error;
    }
});
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItImageOptions->new();
$options->delay(3000);
$grabzIt->URLToImage("http://www.spacex.com", $options);
$grabzIt->SaveTo("images/result.jpg");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItImageOptions();
$options->setDelay(3000);
$grabzIt->URLToImage("http://www.spacex.com", $options);
$grabzIt->SaveTo($filepath);
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItImageOptions.GrabzItImageOptions()
options.delay = 3000
grabzIt.URLToImage("http://www.spacex.com", options)
grabzIt.SaveTo("images/result.jpg")
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::ImageOptions.new()
options.delay = 3000
grabzItClient.url_to_image("http://www.spacex.com", options)
grabzItClient.save_to("images/result.jpg")

如何在執行捕獲之前等待HTML元素出現?

該技術在使用AJAX方法加載內容的網頁上特別有用。 首先使用您的瀏覽器開發人員工具來確定需要等待出現的元素,並記下其ID或類。 然後將此類或ID指定為 標準CSS選擇器 並且一旦該元素變得可見,便會捕獲網頁。 請注意,如果有多個匹配的HTML元素,則它們將在可見時立即顯示。

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.WaitForElement = "#Content";
grabzIt.URLToImage("http://www.spacex.com", options);
grabzIt.SaveTo("images/result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.setWaitForElement("#Content");
grabzIt.URLToImage("http://www.spacex.com", options);
grabzIt.SaveTo("images/result.jpg");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.4.7/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.spacex.com", 
{"waitfor": "#Content"}).Create();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
var options = {"waitForElement":"#Content"};
client.url_to_image("http://www.spacex.com", options);
client.save_to("images/result.jpg", function (error, id){
    if (error != null){
        throw error;
    }
});
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItImageOptions->new();
$options->waitForElement("#Content");
$grabzIt->URLToImage("http://www.spacex.com", $options);
$grabzIt->SaveTo("images/result.jpg");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItImageOptions();
$options->setWaitForElement("#Content");
$grabzIt->URLToImage("http://www.spacex.com", $options);
$grabzIt->SaveTo($filepath);
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItImageOptions.GrabzItImageOptions()
options.waitForElement = "#Content"
grabzIt.URLToImage("http://www.spacex.com", options)
grabzIt.SaveTo("images/result.jpg")
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::ImageOptions.new()
options.waitForElement = "#Content"
grabzItClient.url_to_image("http://www.spacex.com", options)
grabzItClient.save_to("images/result.jpg")