-
-
Save wolph/985a6072b35926eb4a3f9d2cdd0a2dad to your computer and use it in GitHub Desktop.
My updated version:
- uses xPath to get button by text so even if they change the HTML tag this should work
- triggers after 1 second because the popup may not be immediately in page
const run = () => {
const xpath = '//*[contains(text(),"I Agree")]';
const agreeBtn = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if(agreeBtn) agreeBtn.click();
document.querySelector('div[aria-modal]')?.remove();
const form = document.querySelector('form');
if(form?.action?.match(/consent/)?.length === 1) {
form.querySelector('button')?.click();
}
}
setTimeout(run, 1000);
Do I have to reopen the browser in order to changes make effect?
I tried with both scripts of @wolph and @paoloiulita. I use Tampermonkey and I've enabled this addon to work in incognito mode (Chrome), but whatever I use, the f#cking Google s#it still redirects to consent page.
It would be great to make it work, because I often use incognito mode to reduce my activity on Google account.
Screens:
https://i.ibb.co/xJRB59T/scr1.jpg
https://i.ibb.co/YTYwqxp/scr2.jpg
https://i.ibb.co/mS76L6j/scr3.jpg (sorry for Polish lang version)
But the effect is:
https://i.ibb.co/k5B7MJj/scr4.jpg
@mm1992 I've updated the script to include the changes from @paoloiulita with a few small modifications.
With regards to the issues you're experiencing, are you sure the script is running in incognito? Tampermonkey should show how many scripts were executed:
If it's enabled you only need to reload the page. Nothing else should be needed.
Does this script block the "before you continue to google" prompt? Not working for me...
I believe I've updated it to work with every TLD now. Can you try?