Playwright icon

Playwright

Automate browser actions using Playwright

Get Text

AI-generated

Summary

Navigate to a specified URL and extract the text content from a single element identified by a CSS selector or XPath expression.

Inputs

  • URL (required) — The URL to navigate to.
  • Selector Type (required) — Choose whether to select the element by CSS selector or XPath.
  • CSS Selector (required) — The CSS selector string to locate the element if 'CSS Selector' is chosen.
  • XPath (required) — The XPath expression to locate the element if 'XPath' is chosen.
  • Browser (required) — Choose the browser to launch (Chromium, Firefox, Webkit).
  • Browser Launch Options — Options for launching the browser such as headless mode and slow motion delay.

Output shape

a single JSON object per input item

The output JSON contains the extracted text content as 'text', the selector type used ('css' or 'xpath'), and the selector string used. Errors during extraction may cause the node to fail unless 'continue on fail' is enabled. Only the first matched element's text content is returned.

Links

Discussion