How can I bypass cookie consent page?
Most sites have cookie consent pop-ups, which can be closed via our API. We will use Google as an example, but you can apply the same logic to any website.
So to fix this issue and bypass it, we need to accept Google's terms, and we have two approaches to do that:
1. Using a CONSENT Cookie:
Whenever you accept Google's terms, a cookie with the name CONSENT is saved on your computer. It usually contains a YES+ text with a timestamp and the user's country code. So to mimic this behavior, we can visit the page we want to scrape with a cookie that contains a similar value:
from scrapingbee import ScrapingBeeClient
client = ScrapingBeeClient(api_key='API_KEY')
response = client.get(
'https://www.google.com/search?q=Best+Laptops+in+Europe&tbm=shop',
params={
'custom_google': 'true',
'stealth_proxy': 'true',
'country_code':'gb',
'wait': '1500' # Waiting for the content to load (1.5 seconds)
},
cookies= {'CONSENT': 'YES+'} # Sending a cookie with the request
)
if response.ok:
print(response.content)
# Do whatever you want with the request!
else:
print(response.content)
2. Using a JavaScript Scenario:
With this method, we mimic the exact behavior of a typical EU user: We click on the [I agree] button, and we continue our search!
from scrapingbee import ScrapingBeeClient
client = ScrapingBeeClient(api_key='API_KEY')
response = client.get(
'https://www.google.com/search?q=Best+Laptops+in+Europe&tbm=shop',
params={
'custom_google': 'true',
'stealth_proxy': 'true',
'country_code':'gb',
'js_scenario': {"instructions": [{"click": "form > div > div > button"}]}, # Clicking the agreement button
'wait': '1500' # Waiting for the content to load (1.5 seconds)
}
)
if response.ok:
print(response.content)
# Do whatever you want with the request!
else:
print(response.content)
Updated on: 20/01/2026
Thank you!
