Skip to content

Commit 6793411

Browse files
committed
fix: Only enter if-block (and click 'customize') when 'customize' is present
handlePuppetReady() is called very often and in parallel Removing the sleep(1000) the condition (can I click?) and action (I do click) are closer to each other and we have less chance for a race condition.
1 parent a660ae0 commit 6793411

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/middleware/bot.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ export default ((store: Store) => (next: (action: Action) => void) => async (act
3535
// handle cookie popup if present
3636
const cookiePopupRootSelector = '#usercentrics-root';
3737

38-
if ((await electronUtils.elementExists(cookiePopupRootSelector)) && (await electronUtils.elementExists('#uc-center-container', cookiePopupRootSelector))) {
38+
if ((await electronUtils.elementExists(cookiePopupRootSelector)) && (await electronUtils.elementExists('#uc-center-container', cookiePopupRootSelector)) && (await electronUtils.elementExists('[data-testid="uc-customize-button"]', cookiePopupRootSelector))) {
3939
store.dispatch(setBotMessage('🍪⁉️'));
40-
await sleep(1000);
4140
await electronUtils.click('[data-testid="uc-customize-button"]', cookiePopupRootSelector);
4241
await sleep(1000);
4342
await electronUtils.click('[data-testid="uc-deny-all-button"]', cookiePopupRootSelector);

0 commit comments

Comments
 (0)