Playwright
Playwright actions enable modern browser automation (Chromium, Firefox, WebKit).
Important note: only methods decorated with @decorators.robotaction are user actions and are documented here.
Actions
playwright.check
Check checkbox/radio.
Parameters:
browserlocator(required)timeout(optional, default30000)force(optional, defaultFalse)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.click
Click locator.
Parameters:
browserlocator(required)timeout(optional, default30000)button(optional, defaultleft)click_count(optional, default1)delay(optional, default0)force(optional, defaultFalse)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.close
Close current Playwright resources and reset manager state.
Parameters:
browser— browser metadata object.
Return:
browser—None.
playwright.evaluate_js
Execute JavaScript expression on page or locator.
Parameters:
browserexpressionlocator(optional)timeout(optional, default30000)
Return:
result
playwright.fill
Fill locator with value.
Parameters:
browserlocator(required)value(optional, default empty string)timeout(optional, default30000)force(optional, defaultFalse)no_wait_after(optional, defaultFalse)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.get_attribute
Get attribute value from locator.
Parameters:
browserlocator(required)name(required)timeout(optional, default30000)
Return:
value
Exceptions:
ElementNotFoundwhenlocatoris missing.ValueErrorwhennameis empty.
playwright.get_by_alt_text
Locate element by alt text.
Parameters:
browsertextexact(optional, defaultFalse)
Return:
locator
playwright.get_by_label
Locate form control by label text.
Parameters:
browsertextexact(optional, defaultFalse)
Return:
locator
playwright.get_by_placeholder
Locate input by placeholder text.
Parameters:
browsertextexact(optional, defaultFalse)
Return:
locator
playwright.get_by_role
Locate element by ARIA role.
Parameters:
browserrolename(optional)exact(optional, defaultFalse)
Return:
locator
playwright.get_by_test_id
Locate element by data-testid.
Parameters:
browsertest_id
Return:
locator
playwright.get_by_text
Locate element by text.
Parameters:
browsertextexact(optional, defaultFalse)
Return:
locator
playwright.get_by_title
Locate element by title attribute.
Parameters:
browsertextexact(optional, defaultFalse)
Return:
locator
playwright.get_element
Compatibility action that returns one locator for selector.
Parameters:
browserselectorindex(optional)
Return:
element— locator object.
playwright.get_elements
Return all locators matching selector.
Parameters:
browserselector
Return:
elements— locator list.length— number of matches.
Exceptions:
ElementNotFoundwhen no elements are found.
playwright.get_inner_text
Get inner_text from locator.
Parameters:
browserlocator(required)timeout(optional, default30000)
Return:
text
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.get_tabs
Return all tabs from current context.
Parameters:
browser
Return:
tabs— list withtitleandurl.count
playwright.get_text
Get text_content from locator.
Parameters:
browserlocator(required)timeout(optional, default30000)
Return:
text
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.get_title
Get current page title.
Parameters:
browser
Return:
title
playwright.get_url
Get current page URL.
Parameters:
browser
Return:
url
playwright.handle_dialog
Register dialog handler (accept or dismiss).
Parameters:
browseraction(optional, defaultaccept)prompt_text(optional)
Return:
- no return keys.
Exceptions:
ValueErrorwhenactionis invalid.
playwright.hover
Hover over locator.
Parameters:
browserlocator(required)timeout(optional, default30000)force(optional, defaultFalse)modifiers(optional)position(optional)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.is_visible
Check locator visibility.
Parameters:
browserlocator(required)timeout(optional, default5000)
Return:
is_visible
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.locator
Locate element by CSS/XPath selector.
Parameters:
browserselectorindex(optional) — when provided useslocator.nth(index).
Return:
locator
Exceptions:
ValueErrorwhenindex < 0.
playwright.mock_api
Convenience wrapper around playwright.route for mocked fulfill response.
Parameters:
browserurl_patternresponse_body(optional)response_json(optional)status(optional, default200)headers(optional)
Return:
- same return as
playwright.route(no return keys).
playwright.navigate
Navigate page to a new URL.
Parameters:
browserurltimeout(optional, default30000)wait_until(optional, defaultload) —load,domcontentloaded,networkidle,commit.
Return:
- no return keys.
playwright.new_tab
Open new tab and optionally navigate to URL.
Parameters:
browserurl(optional)
Return:
page— new page identifier.
playwright.open
Open browser/context/page and navigate to URL.
Parameters:
url— initial URL.headless(optional, defaultFalse) — run browser without UI.browser_type(optional, defaultchromium) —chromium,firefox,webkit.channel(optional) — Chromium channel (chrome,msedge, etc.).timeout(optional, default30000) — navigation timeout in ms.viewport_width/viewport_height(optional, default1280/720) — viewport size. Ignored whenmaximize=True.maximize(optional, defaultFalse) — open the window using the native maximized size; mutually exclusive withviewport_width/viewport_height.locale,timezone_id,user_agent(optional) — context options.incognito(optional, defaultTrue) — compatibility signature.downloads_path(optional) — directory where downloads are persisted. When omitted defaults to<assets_path>/downloads(or<MARVIN_HOME>/temp/downloadsas a fallback).
Return:
browser— metadata dict withengine,browser_type,channel,headless,incognito,downloads_path.
Exceptions:
ImportErrorwhen Playwright is not installed.ValueErrorwhenbrowser_typeis invalid.- When the browser is opened via
chrome.open, a global context-level download listener is attached and persists each download underdownloads_pathautomatically. The listener resolves UUID/no-extension suggested filenames using URL hints and magic-byte detection, and avoids silent overwrites by appending a numeric suffix (e.g.fatura.zip→fatura_2.zipwhenfatura.zipalready exists). Pureplaywright.openusers do not get this listener; useplaywright.wait_for_download/playwright.save_downloadinstead.
playwright.press_key
Press key on locator.
Parameters:
browserlocator(required)key(optional, defaultEnter)timeout(optional, default30000)delay(optional, default0)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.route
Register network route handler.
Parameters:
browserurl_patternhandler_type(optional, defaultfulfill) —fulfill,continue,abortbody(optional)status(optional, default200)headers(optional)json_data(optional)
Return:
- no return keys.
Exceptions:
ValueErrorwhenhandler_typeis invalid.
playwright.save_download
Save download to explicit path.
Parameters:
browserdownload_info(optional)save_path(required)
Return:
saved_path
Exceptions:
ValueErrorwhensave_pathis missing.
playwright.screenshot
Capture screenshot from page or locator.
Parameters:
browserpath(optional)full_page(optional, defaultFalse)timeout(optional, default30000)locator(optional)type(optional, defaultpng)quality(optional)
Return:
screenshot— bytes whenpathis not provided.- or no return keys when saved directly to file.
playwright.scroll_into_view
Scroll locator into view when needed.
Parameters:
browserlocator(required)timeout(optional, default30000)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.select_option
Select <option> by value, label, or index.
Parameters:
browserlocator(required)value(optional)label(optional)index(optional)timeout(optional, default30000)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.ValueErrorwhen no criterion is provided.
playwright.select_tab
Select tab by index, URL fragment, or title fragment.
Parameters:
browsertab_index(optional)tab_url(optional)tab_title(optional)
Return:
page— selected page identifier.
Exceptions:
ElementNotFoundwhen no tab matches criteria.
playwright.type_text
Type text character-by-character.
Parameters:
browserlocator(required)text(optional, default empty string)delay(optional, default0)timeout(optional, default30000)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.uncheck
Uncheck checkbox.
Parameters:
browserlocator(required)timeout(optional, default30000)force(optional, defaultFalse)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.wait_for_download
Wait for download and save file.
Parameters:
browsertimeout(optional, default30000)save_path(optional)
Return:
downloaddownload_pathsuggested_filenameurl
playwright.wait_for_element
Wait for locator state.
Parameters:
browserlocator(required)timeout(optional, default30000)state(optional, defaultvisible) —visible,hidden,attached,detached.
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.ValueErrorwhenstateis invalid.
playwright.wait_for_element_hide
Wait until locator becomes hidden.
Parameters:
browserlocator(required)timeout(optional, default30000)
Return:
- no return keys.
Exceptions:
ElementNotFoundwhenlocatoris missing.
playwright.wait_for_navigation
Wait for navigation/load state and optional URL match.
Parameters:
browsertimeout(optional, default30000)url(optional)wait_until(optional, defaultload)
Return:
- no return keys.
playwright.wait_for_url
Wait until page URL matches pattern.
Parameters:
browserurl_patterntimeout(optional, default30000)
Return:
- no return keys.
playwright.wait_load
Wait for page load state.
Parameters:
browsertimeout(optional, default60000)state(optional, defaultload) —load,domcontentloaded,networkidle.
Return:
- no return keys.