From df98cc85ff978c491ed20bbdcc054703b3690441 Mon Sep 17 00:00:00 2001 From: dbrockmann Date: Sat, 14 Jun 2025 20:54:34 +0000 Subject: [PATCH 1/2] fix action errors for multi participants --- joinly/providers/browser/platforms/google_meet.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/joinly/providers/browser/platforms/google_meet.py b/joinly/providers/browser/platforms/google_meet.py index 9eada8a..f99b2a3 100644 --- a/joinly/providers/browser/platforms/google_meet.py +++ b/joinly/providers/browser/platforms/google_meet.py @@ -1,3 +1,4 @@ +import contextlib import re from typing import ClassVar @@ -45,6 +46,8 @@ async def leave(self, page: Page) -> None: Args: page: The Playwright page instance. """ + await self._dismiss_dialog(page) + leave_btn = page.get_by_role( "button", name=re.compile(r"^leave", re.IGNORECASE) ) @@ -58,6 +61,8 @@ async def send_chat_message(self, page: Page, message: str) -> None: page: The Playwright page instance. message: The message to send. """ + await self._dismiss_dialog(page) + chat_input = page.locator("textarea[placeholder*='Send a message']") is_chat_visible = await chat_input.is_visible(timeout=1000) @@ -73,3 +78,10 @@ async def send_chat_message(self, page: Page, message: str) -> None: await chat_input.fill(message) await page.wait_for_timeout(500) await page.keyboard.press("Enter") + + async def _dismiss_dialog(self, page: Page) -> None: + """Dismiss any popups that may appear.""" + action_btn = page.locator("div[role='dialog'] [data-mdc-dialog-action]") + with contextlib.suppress(Exception): + if await action_btn.first.is_visible(timeout=100): + await action_btn.first.click() From 83f917a711b69fa9cd10ceac02c5e251aca0b38e Mon Sep 17 00:00:00 2001 From: dbrockmann Date: Sat, 14 Jun 2025 22:55:30 +0000 Subject: [PATCH 2/2] add dialog dismiss to mute/unmute --- joinly/providers/browser/platforms/google_meet.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/joinly/providers/browser/platforms/google_meet.py b/joinly/providers/browser/platforms/google_meet.py index 183b207..e907aac 100644 --- a/joinly/providers/browser/platforms/google_meet.py +++ b/joinly/providers/browser/platforms/google_meet.py @@ -60,6 +60,8 @@ async def mute(self, page: Page) -> None: Args: page: The Playwright page instance. """ + await self._dismiss_dialog(page) + mute_btn = page.get_by_role( "button", name=re.compile(r"^turn off mic", re.IGNORECASE) ) @@ -72,6 +74,8 @@ async def unmute(self, page: Page) -> None: Args: page: The Playwright page instance. """ + await self._dismiss_dialog(page) + unmute_btn = page.get_by_role( "button", name=re.compile(r"^turn on mic", re.IGNORECASE) )