autoconsent
autoconsent copied to clipboard
Site breakage: correctiv.org
Description
The popup on [site]
- [x] is not detected
- [ ] is not dismissed properly
- [ ] other (elaborate below)
Tested on
emulateDevice: {
viewport: {height: 1440, width: 800},
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
},
Tested from country: Puppeteer Geolocation for Washington DC
Autoconsent version:
Screenshot (optional)
I'm getting
CMP error TypeError: Cannot read properties of null (reading 'isHidingRule')
at TabConsent.doOptIn (/home/isumis/Dokumente/blacklight-collector/node_modules/@duckduckgo/autoconsent/dist/autoconsent.puppet.js:588:28)
at /home/isumis/Dokumente/blacklight-collector/src/collector.ts:201:29
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
couldnt load json safely undefined
Using the following code
const autoconsent = require('@duckduckgo/autoconsent/dist/autoconsent.puppet.js');
const extraRules = require('@duckduckgo/autoconsent/rules/rules.json');
const consentomatic = extraRules.consentomatic;
const rules = [
...autoconsent.rules,
...Object.keys(consentomatic).map(name => new autoconsent.ConsentOMaticCMP(`com_${name}`, consentomatic[name])),
...extraRules.autoconsent.map(spec => autoconsent.createAutoCMP(spec)),
];
page.once('load', async () => {
const tab = autoconsent.attachToPage(page, url, rules, 10);
try {
await tab.checked;
await tab.doOptIn();
} catch (e) {
console.warn(`CMP error`, e);
}
});