Skip to content

Commit

Permalink
chg: Speedup locator handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed May 30, 2024
1 parent fbe79fb commit c377b1f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
26 changes: 17 additions & 9 deletions playwrightcapture/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ async def handler() -> None:
if await page.locator("#didomi-notice-agree-button").is_visible():
await page.locator("#didomi-notice-agree-button").click(timeout=2000)

await page.add_locator_handler(page.locator(".didomi-popup-view").last, handler)
await page.add_locator_handler(page.locator(".didomi-popup-view").last, handler, times=1, no_wait_after=True)
self.logger.info('Didomi handler added')

async def __dialog_onetrust_clickthrough(self, page: Page) -> None:
Expand All @@ -484,7 +484,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.locator('#onetrust-banner-sdk').last,
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('OT handler added')

Expand All @@ -495,7 +496,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.locator('#hs-eu-cookie-confirmation').last,
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('HS handler added')

Expand All @@ -506,7 +508,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.locator('#CybotCookiebotDialogBody'),
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('Cookiebot handler added')

Expand All @@ -522,7 +525,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.get_by_role("alertdialog").last,
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('alert dialog handler added')

Expand All @@ -541,7 +545,8 @@ async def handler() -> None:
self.logger.info('Consent window found, but no button to click through.')
await page.add_locator_handler(
page.get_by_role("dialog").last,
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('dialog handler added')

Expand All @@ -552,7 +557,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.locator('.cmplz-show'),
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('Complianz handler added')

Expand All @@ -563,7 +569,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.locator('.con-wizard'),
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('Yahoo handler added')

Expand All @@ -574,7 +581,8 @@ async def handler() -> None:

await page.add_locator_handler(
page.locator('#ppms_cm_popup_overlay'),
handler
handler,
times=1, no_wait_after=True
)
self.logger.info('Yahoo handler added')

Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c377b1f

Please sign in to comment.