Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions joinly/providers/browser/platforms/google_meet.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import contextlib
import re
from typing import ClassVar

Expand Down Expand Up @@ -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)
)
Expand All @@ -57,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)
)
Expand All @@ -69,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)
)
Expand All @@ -82,6 +89,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)

Expand All @@ -97,3 +106,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()