Skip to content

Playwright

flowtask.interfaces.playwright

PlaywrightService

PlaywrightService(*args, **kwargs)

Bases: ABC

PlaywrightService

An interface for making HTTP connections using Playwright, analogous to your SeleniumService.

check_by_attribute

check_by_attribute(attribute)

Convert a tuple (attribute, value) into a Playwright selector. For example, ('id', 'submit') becomes '#submit' and ('xpath', '//button') becomes 'xpath=//button'.

close_driver async

close_driver()

Close the page, browser context, browser, and stop Playwright.

get_driver async

get_driver()

Initialize Playwright, launch a browser (with proxy and/or mobile emulation if configured), and return a new Page instance.

get_etree async

get_etree()

Return a tuple of lxml etree objects (using etree.fromstring and html.fromstring) for the current page content.

get_page async

get_page(url, cookies=None, retries=3, backoff_delay=2)

Navigate to a given URL, optionally set cookies, wait for page load, and optionally handle any cookie-acceptance banners.

get_soup async

get_soup(parser='html.parser')

Return a BeautifulSoup object for the current page content.

parse_cookies

parse_cookies(cookie_pair)

Parse a cookie string into a dictionary.

proxy_playwright

proxy_playwright(user, password, endpoint)

Return a proxy configuration dictionary for Playwright.

save_screenshot async

save_screenshot(filename)

Save a screenshot of the entire page or of a specific element if configured.

search_google_cse async

search_google_cse(query, max_results=5)

Perform a Google Custom Search Engine (CSE) search using Playwright. Returns a list of results where each result is a dict with 'title' and 'link'.