Skip to content
CSS SELECTOR CHROME EXTENSION

See the element.
Copy its selector.

Inspect an element on your page and review its CSS selector, XPath, and Playwright output. Copy the format you need, with the target still in view.

Free extension for desktop Chrome. Try it before signing up.

FROM ELEMENT TO SELECTORIllustrative example
studio.example / settings
SELECTED ELEMENT
Save changes
CSS selectorbutton
[data-testid="save-team"]

The selector and the element, side by side.

  1. 01Inspect the target.
  2. 02Review its selectors.
  3. 03Copy and verify.
01 / GET A FEEL FOR IT

Pick the element.
See what identifies it.

Choose a button in the sample, switch formats, and copy its selector. The selected element stays in view.

Click an element to inspectINTERACTIVE EXAMPLE
studio.example / settings
ACME STUDIO

Team settings

Workspace
Acme Studio
Team plan
3 seats Annual billing
Payment methods & invoices

Choose Add seat, Save changes, or Manage billing.

button

Save changes

SELECTED ELEMENT
Choose your format
CSS selector
[data-testid="save-team"]

Checking sample…in the sample HTML
ATTRIBUTE TO REVIEWdata-testid="save-team"

An explicit test attribute. Keep it unique within the scope of your test.

Confirm the target and match count again on your own page.

Sample HTML · No account needed

This example lets you inspect three sample buttons. Use the extension to inspect your own page.

02 / UNDERSTAND THE MATCH

Know what
you’re matching.

A CSS selector is a pattern that identifies HTML elements. It can match a tag, class, ID, attribute, or relationship between elements.

A selector may find one element, several, or none. Check the match in the page state that matters to your work.

Explore the CSS selector reference

A few patterns worth knowing

QUICK REFERENCE
Type
button

Every button element.

Class
.primary

Elements with the primary class.

ID
#save-team

The element with this ID.

Attribute
[data-testid="save-team"]

Elements with this exact attribute value.

Descendant
.dialog button

Buttons anywhere inside .dialog.

State
button:disabled

Buttons that are currently disabled.

03 / TAKE IT TO YOUR OWN PAGE

From the live page
to your next check.

  1. 01

    Inspect the element

    Open the extension on your page and choose the button, field, or other element you want to work with.

  2. 02

    Review the alternatives

    Compare the CSS selector and XPath in Alternative Selectors. Find CSS-based Playwright output in Test Automation.

  3. 03

    Copy, then verify

    Check that the selector finds the intended element in your app. In a test, verify the action and the result that follows.

Add to Chrome
FOLLOW YOUR NEXT QUESTION

Go from a match
to a useful test.

Explore all workflows
A FEW USEFUL DETAILS

Before you
copy and paste.

How do I copy a CSS selector in Chrome?

You can inspect an element in Chrome DevTools and use Copy selector from its context menu. With Samelogic, select an element on the page, review Alternative Selectors, and copy the CSS selector or XPath you want to use.

What is the difference between CSS selectors and XPath?

CSS selectors match elements by patterns such as a class, ID, attribute, or position. XPath uses expressions to navigate the document tree. Use the format supported by your tool and verify that it finds the intended element.

What does the Playwright output include?

The extension provides CSS-based Playwright output for the selected element. It is a starting point to review in your test. You still need to confirm the target, add the relevant actions and assertions, and run the test.

Will a copied selector stay reliable?

That depends on what the selector uses and how the page changes. Generated classes, changing IDs, and position-based paths can be fragile. Prefer attributes your team intentionally maintains, check the match count, and verify the behavior in your test.

Can I try it without an account?

Yes. You can try the desktop Chrome extension before signing up. The example on this page also works without an account. Saving and team features have separate account and plan requirements.

Can the extension inspect every page?

Chrome restricts extensions on some pages, including its internal pages and the Chrome Web Store. Frames, shadow DOM, and dynamic page content can also affect inspection and selector behavior. Check the target in the page and tool where you plan to use it.

START WITH THE ELEMENT IN FRONT OF YOU

Your page.
Your next selector.

Inspect an element and review its selectors with our extension.

Add to ChromeTry it before signing up.