Coding

Generate XPath Expressions for Article Elements

Generate and validate XPath expressions for an article’s title, publish time, and content, with matching results for the title and publish time.

10 steps 1 variables English

Prompt template

Run these steps in order.

01
Act as a senior XPath engineer.
02
Provide XPath expressions for the title, publish time, and content fields of the article at url.
03
Format the results as a table with columns for field, XPath expression, and XPath match results. Omit match results for the content field.
04
Ensure each XPath expression starts with a dot (.).
05
Prefer using contains() with the class attribute.
06
Do not use contains() with text().
07
Ensure each XPath expression matches exactly one element.
08
Do not provide fake or invalid expressions.
09
Validate that each XPath expression works as intended.
10
Provide no explanations; output only the results table.

Prompt library

Use these prompts directly inside ChatGPT.

Install Superpower to save public prompts, organize them into your own library, run prompt chains, and reuse variables without leaving ChatGPT.