You're reading the documentation for a development version. For the latest released version, please have a look at master.
queens_solver.browser
Functions
|
Open a Queens game page using the specified backend. |
|
Open the LinkedIn Queens game page and start a game session. |
Module Contents
- queens_solver.browser.open_queens_game(p, mode='linkedin', **kwargs)[source]
Open a Queens game page using the specified backend.
Dispatches to a backend-specific implementation that launches and initializes a Queens game page. Currently supports LinkedIn only.
- Parameters:
p (playwright._impl._playwright.Playwright) – Active Playwright instance from
sync_playwright().mode (Literal['linkedin']) – Backend to use. Defaults to
"linkedin".**kwargs – Additional keyword arguments forwarded to the backend-specific implementation (e.g.
url).
- Returns:
Tuple of
(page, mode)wherepageis the Playwright page object for the opened game.- Raises:
RuntimeError – If the game page cannot be opened successfully.
ValueError – If an unsupported
modeis specified.
- Return type:
tuple[playwright._impl._page.Page, str]
- queens_solver.browser.open_queens_game_linkedin(p, logger, url='https://linkedin.com/games/view/queens/desktop')[source]
Open the LinkedIn Queens game page and start a game session.
Launches a Chromium browser, navigates to the Queens game page, clicks the “Play game” button, and dismisses any tutorial modal with an Escape key press.
- Parameters:
p (playwright._impl._playwright.Playwright) – Active Playwright synchronous API instance.
logger (logging.Logger) – Logger for progress and debug messages.
url (str) – URL of the LinkedIn Queens game page. Defaults to
"https://linkedin.com/games/view/queens/desktop".
- Returns:
Playwright
Pageobject for the active game page after the game has been started.- Raises:
playwright.sync_api.TimeoutError – If required page elements fail to appear within the default timeout.
playwright.sync_api.Error – If browser interaction fails during page initialization.
- Return type:
playwright._impl._page.Page