Skip to content

Commit

Permalink
Add EU cookie consent banner handling to OIDC sign in (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnaras authored Mar 18, 2024
1 parent 8b3c9ee commit 690e7ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add EU cookie banner handling to OIDC sign-in tool",
"packageName": "@itwin/oidc-signin-tool",
"email": "[email protected]",
"dependentChangeType": "patch"
}
11 changes: 11 additions & 0 deletions packages/oidc-signin-tool/src/SignInAutomation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ async function handleConsentPage<T>(context: AutomatedSignInContext<T>): Promise
const acceptButton = await page.waitForSelector(
"xpath=(//button/span[text()='Accept'] | //div[contains(@class, 'ping-buttons')]/a[text()='Accept'])[1]"
);

// In EU there is a cookie consent banner covering the accept button, and it must be dismissed first
const cookieAcceptButton = await page.waitForSelector(
"#onetrust-accept-btn-handler",
{ timeout: 1000 }
);

if (await cookieAcceptButton.isVisible()) {
await cookieAcceptButton.click();
}

await acceptButton.click();
}
}
Expand Down

0 comments on commit 690e7ef

Please sign in to comment.