waft.actions.system_actions.browser_actions module

class waft.actions.system_actions.browser_actions.BrowserActions(node: BaseNode)

Bases: object

Actions related to test system browser instances.

property browser_session: Generator[Browser, Any, None]

Context manager to yield a new Playwright browser session on the test node. Closes session on exit.

is_dns_blocked(domain: str, retry_on: Literal['blocked', 'unblocked'] | None, timeout: int = 180) bool

Return a boolean indicating if the given domain is blocked by DNS policy.

Parameters:
  • domain – URL string of domain to check for being blocked

  • retry_on – Argument to retry based on the returned value (wait <timeout> seconds for a given outcome)

  • timeout – Max time to retry for (default 30 seconds)

is_http_blocked(browser: Browser, domain: str, retry_on: Literal['blocked', 'unblocked'] | None, timeout: int = 180, page_output: Path | None = None) bool

Return a boolean indicating if the given domain is blocked by HTTP policy.

Parameters:
  • browser – Playwright browser session to use for testing if a site is blocked

  • domain – URL string of domain to check for being blocked

  • retry_on – Argument to retry based on the returned value (wait <timeout> seconds for a given outcome)

  • timeout – Max time to retry for (default 30 seconds)

  • page_output – Optional path to write page content to