Skip to content

Commit e20ac71

Browse files
authored
handle "Cookie Preferences and Opt-Out Rights" modal (#1276)
1 parent 86a74db commit e20ac71

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • testsupport/devsandbox-dashboard

testsupport/devsandbox-dashboard/setup.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,18 @@ func handleCookiesConsent(t *testing.T, page playwright.Page) {
131131
contentFrame := iframe.ContentFrame()
132132
require.NotNil(t, contentFrame)
133133

134-
// find the agree button
135-
agreeButton := contentFrame.GetByRole("button", playwright.FrameLocatorGetByRoleOptions{
134+
// TrustArc can show different modals (e.g. full consent vs. simplified); accept whichever button is present.
135+
agreeProceed := contentFrame.GetByRole("button", playwright.FrameLocatorGetByRoleOptions{
136136
Name: "Agree and proceed with",
137137
})
138138

139-
err = agreeButton.Click()
139+
// to some us states, like texas, it appears the "Cookie Preferences and Opt-Out Rights" modal
140+
acceptDefault := contentFrame.GetByRole("button", playwright.FrameLocatorGetByRoleOptions{
141+
Name: "Accept default",
142+
})
143+
consentButton := agreeProceed.Or(acceptDefault)
144+
145+
err = consentButton.Click()
140146
require.NoError(t, err)
141147

142148
// wait for iframe to disappear (indicates cookie acceptance complete)

0 commit comments

Comments
 (0)