@cliqz/autoconsent
Version:
This is a library of rules for navigating through common consent popups on the web. These rules can be run in a Firefox webextension, or in a puppeteer orchestrated headless browser. Using these rules, opt-in and opt-out options can be selected automatica
27 lines (26 loc) • 944 B
JavaScript
import AutoConsentBase from "./base";
// Note: JS API is also available:
// https://help.consentmanager.net/books/cmp/page/javascript-api
export default class Evidon extends AutoConsentBase {
constructor() {
super("Evidon");
}
detectCmp(tab) {
return tab.elementExists("#_evidon_banner");
}
detectPopup(tab) {
return tab.elementsAreVisible("#_evidon_banner");
}
async optOut(tab) {
if (await tab.elementExists("#_evidon-decline-button")) {
return tab.clickElement("#_evidon-decline-button");
}
tab.hideElements(["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
await tab.clickElement("#_evidon-option-button");
await tab.waitForElement("#evidon-prefdiag-overlay", 5000);
return tab.clickElement("#evidon-prefdiag-decline");
}
async optIn(tab) {
return tab.clickElement("#_evidon-accept-button");
}
}