HEX to OKLCH Converter
HEX and RGB to the OKLCH colour space for modern CSS — and back, gamut-mapped.
Turn XPath into CSS selectors — and say plainly when CSS cannot express one.
Used for moving Selenium or Scrapy selectors to Playwright, Cypress or querySelectorAll.
The XPath to CSS Selector Converter translates expressions line by line — attributes, contains, starts-with, positions and last() — and says plainly when CSS cannot express one.
Old test suites are full of XPath. Newer tools — Playwright, Cypress, Testing Library, plain querySelectorAll — prefer CSS, which is shorter, faster in most engines, and far easier to read in a code review. Translating dozens of selectors by hand is dull and error-prone.
Paste a list of expressions, one per line, and get CSS. Attribute matches, contains(@class, …), starts-with(@href, …), position filters, last(), descendant and child steps, wildcards and namespace prefixes are all handled. Where CSS genuinely cannot express something — a parent axis, matching on text() — the line says so instead of producing a selector that quietly matches the wrong element, which is the worst thing a converter can do to a test suite.
Attribute equality, contains(), starts-with(), [n] and last().
[3] becomes :nth-of-type(3), not :nth-child(3).
A parent axis or text() match reports why, rather than guessing.
Paste a page-object file and convert every line together.
Each XPath next to its CSS, ready to copy one at a time.
One per line — a whole page-object file is fine.
Each line converts in place, with a table underneath.
The reason is written where the selector would be.
Ready for Playwright, Cypress or querySelectorAll.
CSS has no parent or ancestor axis and cannot match text content. //div/parent::section and //a[text()="Next"] have no CSS equivalent — Playwright’s :has() and text engines cover some of those cases.
XPath’s [3] counts the third matching element; CSS’s nth-child counts the third child whatever its tag. nth-of-type is the accurate translation.
Yes, when the value is a plain class name — which is what people mean by it. For other attributes it becomes the [attr*="x"] substring match, exactly as contains() does.
In browsers, usually — querySelectorAll is heavily optimised, while XPath evaluation is not. The bigger win is readability in review.
What people who use the XPath to CSS Selector Converter think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the XPath to CSS Selector Converter. It takes half a minute and no account.
Write the first reviewHEX and RGB to the OKLCH colour space for modern CSS — and back, gamut-mapped.
Re-encode audio at a new bitrate, sample rate or format — with an honest warning.
Convert OGG Vorbis and Opus audio to MP3 for players that will not touch them.
Read an EPUB as plain text — chapter by chapter, in reading order.
Strip a .docx back to plain text — words and paragraphs, nothing else.
A README or a set of notes as a properly laid out PDF, headings and all.
Clean, semantic HTML from a .docx — no Word class soup, images embedded.
How many grams in a cup of flour, sugar, butter, rice or 36 more.