Skip to content

Commit

Permalink
Apply the removeSelectors to the loaded page
Browse files Browse the repository at this point in the history
  • Loading branch information
franrou committed Sep 27, 2024
1 parent 7da2886 commit 792b583
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion loginAndNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,20 @@ module.exports = async(page, scenario, config) => {

if (scenario.loginRedirectTo) {
await page.goto(scenario.loginRedirectTo, {
waitUntil: 'networkidle0',
waitUntil: 'networkidle0'
});
}

// Apply the removeSelectors to the loaded page.
if (scenario.removeSelectors) {
await page.evaluate((selectors) => {
var elements = document.querySelectorAll(selectors);

elements.forEach((element) => {
element.remove();
});
}, scenario.removeSelectors);
}
}
}
};

0 comments on commit 792b583

Please sign in to comment.