Google Terms of use always need accept: "accept all" or "reject all"

78 Views Asked by At

When I normally start the chrome browser, I don't have to accept anything anymore, it works right away. But using chromedriver (python, selenium) I have to accept conditions every time.

I don't use incognito mode. In the settings, I set the acceptance of cookies.

from time import sleep
from selenium import webdriver

chromeDriverPath=r'C:\Users\Aorus\Downloads\Z_ARCHIWUM\PythonScript\chromedriver_win32\chromedriver.exe'

browser = webdriver.Chrome()
browser.get('https://google.com')

Is there any line of code that I can accept automatically? Or maybe something else needs to be changed in the browser settings?

enter image description here

Thanks

1

There are 1 best solutions below

0
Ruben On

You can click it like you would click any other element on the page. Since it is an element with a dynamic id you could locate it by text. Something like this as locator:

xpath=//button/div[contains(text(),'Accept all')]