With GDPR and various other privacy laws cookie notifications within web pages have become very common, however these notifications are usually not desirable within a screenshot.
GrabzIt can automatically remove common cookie notifications that appear within a web page, to do so just turn on the no cookie notifications feature as shown below.
//The client should be stored somewhere and reused! GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.NoCookieNotifications = true; grabzIt.URLToImage("https://www.bbc.com", options); await grabzIt.SaveAsync("https://www.mywebsite.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); ImageOptions options = new ImageOptions(); options.setNoCookieNotifications(true); grabzIt.URLToImage("https://www.bbc.com", options); grabzIt.Save("https://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.5.2/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("https://www.bbc.com", {"nonotify":1}).Create();
</script>
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); client.url_to_image("https://www.bbc.com", {"noCookieNotifications":true}); client.save("https://www.example.com/handler", 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->noCookieNotifications(1); $grabzIt->URLToImage("https://www.bbc.com", $options); $grabzIt->Save("https://www.mywebsite.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = new \GrabzIt\GrabzItImageOptions(); $options->setNoCookieNotifications(true); $grabzIt->URLToImage("https://www.bbc.com", $options); $grabzIt->Save("https://www.mywebsite.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.noCookieNotifications = True grabzIt.URLToImage("https://www.bbc.com", options) grabzIt.Save("https://www.mywebsite.com/handler.py")
https://api.grabz.it/convert?key=Sign in to view your Application Key&nonotify=1&format=jpg&url=https%3A%2F%2Fwww.bbc.com%2F
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzIt::ImageOptions.new() options.noCookieNotifications = true grabzIt.url_to_image("https://www.bbc.com", options) grabzIt.save("https://www.mywebsite.com/handler/index")
If the cookie notification is not one of the common types that GrabzIt can remove we have the following four other techniques that can be used to try to remove them.
Use the developer tools of your browser to see if there is a cookie added when a cookie notification is accepted. If there is add this to GrabzIt, this will then be used for all the future screenshots, suppressing the notification. Alternatively enable the user cookie behaviour mode, which will automatically record all of the permanent browser cookies that are encountered during a capture.
Another technique is to hide the unwanted page elements. To do this you need to find CSS selectors of the cookie notification element and then pass this to GrabzIt.
The next option is to set the country parameter to the US, as this law is only relevant to the EU some websites won't show the notification if you take the screenshot from the United States.
You can actually mimic human behaviour by clicking the notification popup accept button and thereby closing the popup. To do this pass the CSS selector of the button to the click option of the API.
Finally you can try setting the requestAs
parameter to search engine. As some websites will not show cookie notifications if it thinks it's a search engine that is viewing the site.