puppeteer scripts
This commit is contained in:
30
Workflow/MyDealz Kommentare/puppeteer_cookie_banner_click.js
Normal file
30
Workflow/MyDealz Kommentare/puppeteer_cookie_banner_click.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// Navigate to an IP lookup service
|
||||
await $page.setViewport({
|
||||
width: 1024,
|
||||
height: 768,
|
||||
deviceScaleFactor: 1,
|
||||
});
|
||||
|
||||
const deal_url = $json.message.link_preview_options.url;
|
||||
|
||||
await $page.goto(deal_url, { waitUntil: ['load', 'domcontentloaded'] });
|
||||
|
||||
|
||||
// Extract the IP address from the page content
|
||||
const selector = 'button[data-t="acceptAll"]';
|
||||
//const banner = 'div.popover-content.flex--inline';
|
||||
|
||||
await Promise.all([
|
||||
await $page.waitForSelector(selector, { visible: true }),
|
||||
await $page.evaluate((selector) =>
|
||||
document.querySelector(selector).click(), selector),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
//await $page.click(selector);
|
||||
|
||||
const cookies = await $page.cookies();
|
||||
|
||||
return [{ cookies }, {"url": deal_url}];
|
||||
Reference in New Issue
Block a user