Elbuz finds the name, price, SKU or photo on a site page by a selector — the value's address in the markup. A short, precise selector survives a redesign; a mistake breaks off parsing of the whole page.
When you need this:
- The price is in an attribute, not the text —
::attr(content)takes it from structured data. - Generated classes change their endings —
[class*=…]catches the unchanging part of the name. - You need the cell next to “Weight” —
:contains()or XPath finds it by text, not row. - The selector finds nothing — the symptom table shows the cause and fix.
Where to start: recipes for product fields.
What a selector can point to
- An element by tag, class or attribute — by an exact match, the start, the end or part of the value.
- Position and content — the pseudo-classes
:nth-child,:contains,:has,:notand others. - An attribute value — a link, the price from structured data, a photo from
srcset. - The parent or a neighboring cell — XPath, when can't reach it.
- Ready-made recipes — name, price, SKU, stock status, photos, specifications, pagination.
Two languages: CSS and XPath
A selector is written in one of two languages. By default the cell expects a CSS selector — the same kind web developers use to describe styles. If you prefer XPath, select the “XPath” checkbox in the same rule row.
1
Selector column2
XPath checkbox3
Price row- Selector column — type the address of the value on the page here.
- XPath checkbox — without it an XPath expression breaks the parsing of the whole page instead of simply finding nothing.
- Price row — every field has its own selector, and they are set independently.
The checkbox isn't cosmetic. XPath entered in a row without it doesn't just “find nothing” — parsing of that page breaks off with an error. The log still shows response code 200, so everything looks fine from the outside, but there's no data. A CSS selector with a syntax error breaks off parsing the same way: one extra bracket costs you the whole page.
The difference between “found nothing” and “error” matters when you look for the cause. A selector that simply didn't find an element returns an empty result and parsing moves on — the other fields from the same page come through normally. A selector with an error stops the whole page.
The basics: tag, class, attribute
Four ways to point to an element, which make up almost any working selector:
| Syntax | What it selects |
|---|---|
h1 | all h1 tags on the page |
.price | everything with the price class |
#product-card | the element with this id |
span[itemprop=price] | a span with this attribute |
div.card > a | a link placed directly inside div.card |
div.card a | a link anywhere inside div.card, even five levels deep |
Square brackets support more than an exact match. A character before the equals sign changes how the value is compared:
| Operator | Condition | Example |
|---|---|---|
= | the value is exactly this | a[rel=nofollow] |
^= | starts with | a[href^=/product/] |
$= | ends with | img[src$=.jpg] |
*= | contains the substring | a[href*=catalog] |
!= | the value is different | input[type!=hidden] |
~= | contains this word in a space-separated list | div[class~=in-stock] |
|= | equals the value or starts with “value-” | span[lang|=uk] |
The *= operator saves you on sites where classes are generated by a build tool and look like price__value_a7f3: div[class*=price__value] survives a change of the ending, while div.price__value_a7f3 doesn't.
Full list of pseudo-classes
A pseudo-class narrows the selection by position or content. Our parser supports exactly this set — anything else you may see in CSS references won't work here:
| Pseudo-class | What it does |
|---|---|
:first-child, :last-child | the first or last among its siblings |
:nth-child(n), :nth-last-child(n) | the n-th in order, from the start or from the end |
:first-of-type, :last-of-type, :nth-of-type(n) | the same, but only elements with the same tag are counted |
:only-child | the only child of its parent |
:empty, :not-empty | an empty / non-empty element |
:contains(text) | contains the text |
:has(selector) | contains an element matching the selector |
:not(selector) | everything except what matches the selector |
:checked, :disabled, :enabled | the state of form elements |
:contains() has two optional arguments. The second turns case sensitivity on or off, the third requires a full match instead of an occurrence:
td:contains(Warranty)— contains this word, case-sensitive;td:contains(warranty, false)— not case-sensitive;td:contains(Warranty, true, true)— the cell text is exactly this word.
When the match is case-sensitive (:contains(text) or the second argument true), :contains() looks at the element's own text, not at the text of all its descendants together. With the markup <div><span>Warranty</span></div>, div:contains(Warranty) finds nothing, while span:contains(Warranty) finds it. This is the most common reason a “pseudo-class doesn't work”. With the second argument false, the whole text including nested tags is checked, so div:contains(warranty, false) finds this div.
Take an attribute instead of text
By default the found element's text is taken. To take an attribute value, add ::attr(name) to the selector. Without it, half of all sites can't be parsed — the price and stock status often sit not in the text but in markup meant for search engines.
| Task | Selector |
|---|---|
| Product link | a.product-link::attr(href) |
| Price from structured data | meta[itemprop=price]::attr(content) |
| Lazy-loaded photo | img.photo::attr(data-src) |
| Photo from a set of sizes | img.photo::attr(srcset) |
| SKU from a data attribute | div[data-sku]::attr(data-sku) |
srcset is handled differently at different steps. In the “Product card” operation, the app picks the link with the largest width from the set — the full size, not a thumbnail. In the product list there's no such choice: the last link in the set is taken. If listing photos come in small, use another attribute — usually there's a data-src or src with the full size next to it.
Recipes for product fields
Typical cases that make up most setups. The classes in the examples are made up — use your own; what matters here is the form.
| What you need | How it usually looks in the markup | Selector |
|---|---|---|
| Product name | the only h1 on the page | h1 |
| Name in the listing | the text of the link to the product page | div.catalog a.name |
| Price | a separate block with the currency next to it | div.price-current |
| Price in structured data | an attribute, no text | meta[itemprop=price]::attr(content) |
| Old price — so you DON'T take it | sits next to the current one | div.price:not(.price-old) |
| SKU | the line “Code: 12345” | span.sku + “Regular expression” in the same rule row |
| Stock status | the label “In stock” | div.stock |
| Stock status by class | the class changes, no text | div[class*=in-stock] |
| All gallery photos | links to the full size | a[data-fancybox=gallery]::attr(href) |
| Only the product tiles that have a picture | the list has placeholder rows | div.card:has(img) a::attr(href) |
| Specification value | a “name — value” table | tr:contains(Weight) td:last-child |
| Description | a block with markup you need to keep | div.description + the “Get HTML” checkbox |
| Link to the second page of a section | pagination at the bottom | ul.pagination a:not(.active)::attr(href) |
Read the specification row carefully: tr:contains(Weight) td:last-child takes the table row that contains the word “Weight”, and the last cell of that row. This is more reliable than counting rows by number: products have different sets of specifications, and tr:nth-child(4) points to the wrong row for every other product.
When you need XPath
CSS is enough in most cases, and it's better to start with it — it's shorter and easier to read six months later. Use XPath when you need to go up the tree or check a condition that CSS doesn't have.
| Task | XPath |
|---|---|
| Take the parent of the found element | //span[@class="sku"]/.. |
| The cell to the right of the cell with text | //td[text()="Weight"]/following-sibling::td[1] |
| The second block with a class | (//div[@class="price"])[2] |
| An element by exact text | //a[normalize-space(text())="Buy"] |
Don't forget the “XPath” checkbox in the same row — without it the page isn't parsed at all.
Why a selector finds nothing
| Symptom | Most likely cause | What to do |
|---|---|---|
| All fields on the page are empty | one of the rules has a syntax error or XPath without the checkbox — parsing broke off | check all rules of the operation, not just the one that “doesn't work” |
| One field is empty | the selector didn't find the element | look at the page markup yourself: the class may be spelled differently or be generated |
| The name came in empty, though the site shows it | the value is rendered by a script in the browser and isn't in the source markup | turn on the script execution mode in the source settings |
| Markup junk instead of text | the “Get HTML” checkbox is selected | clear it or narrow the list of allowed tags |
| The price came in as zero | the selector points to a block where the price is in words or in an attribute | use ::attr(content) from the structured data |
| All photos are taken, icons included | the selector is too broad, for example just img | narrow it to the gallery container: div.gallery img::attr(src) |
| The selector worked, but broke after a site update | a long chain like div:nth-child(3) > div > span breaks from one extra banner | rewrite it shorter — by class or attribute |
The :contains() pseudo-class doesn't work | the text is in a nested tag, not in the element's own text | point to the tag that contains the text directly |
Scenarios
Each field row has four selector columns — from “Selector #1” to “Selector #4”. In the “Product card” operation, the app tries them in order and stops at the first one that returns a value. Photos are the exception: all filled-in selectors apply. First the app finds the product block by the operation selector; with no selector in the operation row, the whole page is the block, and if the block isn't found, the product fields aren't filled. All scenarios below rely on this order.
- Start or end
- Action or result
- Decision: the path depends on the answer
The price of a sale product is in a different block
Task: regular products have the price in one block; sale products don't have that block, and the price sits in another one.
What to turn on: in the “Price” row of the “Product card” operation, put the regular price block in “Selector #1” and the sale price block in “Selector #2”.
What you get: where the first selector found a price, that price is saved. The second selector applies only if the field is still empty after the first. A block with no digits gives a price of 0.00 — that value isn't saved, and the app moves on to the next selector. What won't happen: two prices won't be merged. If one selector found several prices, the field gets the first non-zero one.
A default value when the page doesn't have one
Task: the supplier shows a stock status for some products, other products have no such block at all, and they all need the same value.
What to turn on: in the “Stock status (from price list)” row of the “Product card” operation, put the status block in “Selector #1” and the text you need in curly braces in “Selector #2”, for example {Made to order}.
What you get: text in curly braces isn't an address on the page but a ready value: the app takes it without the braces and doesn't search. Since “Selector #2” applies only to an empty field, products with a status block get the text from the page, and the rest get Made to order. What won't happen: if you put the braces in “Selector #1”, nothing is taken from the site — every product gets this text, and the row's next selectors don't apply.
The SKU is written as “SKU: 12345”
Task: you only need the digits in the SKU, but the page shows a label next to them.
What to turn on: in the “Supplier SKU” or “Manufacturer SKU” row — a selector for the SKU block, for example span.sku.
What you get: in these two fields the words «Артикул», «Арт.», «Код товару», «Код» (Ukrainian for “SKU”, “Art.”, “Product code”, “Code”), “SKU” and the colon are cut out automatically, no regular expression needed. For another format, for example an SKU in brackets after the name, fill in “Regular expression” with parentheses around the part you need: the field gets the contents of the first group of the first match. What won't happen: if the expression finds nothing, the value isn't erased — the field gets what the selector returned.
Full description with paragraphs and pictures
Task: bring over the product description with its paragraphs and lists, not as one solid block of text.
What to turn on: in the “Full description” row — a selector for the description block, the “Get HTML” checkbox, and in the “Allowed HTML tags” column — the tags to keep, for example <p><ul><li><img>.
What you get: the field gets the block's markup with only the listed tags left. Relative picture addresses inside the description are completed with the site address. The style attribute and HTML comments are removed regardless of the settings. If the selector found several blocks, they're joined with a space, not with the “Value delimiter”. What won't happen: without the “Get HTML” checkbox and with an empty “Allowed HTML tags” column, all tags are removed and the description comes in as plain text.
Gallery photos plus a separate main photo
Task: on the page the main photo sits apart from the gallery, and you need both.
What to turn on: in the photo row (labeled image in the “Field name” column), put the gallery links in “Selector #1”, for example div.gallery a::attr(href), and the main photo in “Selector #2”, for example img.main::attr(src).
What you get: for photos the app doesn't stop at the first selector that worked; it applies all filled-in ones and collects the results into one list. Addresses containing placeholder, no-photo, no-image, no_image, empty or /brand/ are dropped one by one — the other photos stay. What won't happen: a “no photo” placeholder won't become the product's main photo.
FAQ
Where do I get a selector if I'm not a web developer?
The easiest way is to open the page in a browser, right-click the value you need and choose “Inspect”. The browser highlights the markup line: it shows the tag, class and attributes that make up the selector. In the app itself there's an AI assistant next to the rules: give it a piece of markup and it replies with a ready selector.
The browser gives a very long selector. Can I paste it?
Technically yes, it will work. In practice it will last until the first site redesign: a chain with :nth-child breaks even from one extra banner in the block. Take the nearest class or attribute from that chain and write it short.
What happens if the selector finds several elements?
They're joined with the “Value delimiter” from the same rule row, and if that column is empty — with a comma and a space. Categories are always joined with a slash with spaces, photos with three vertical bars, and with “Get HTML” — with a space. For a single-value field, narrow the selector.
CSS or XPath — which should I choose?
Start with CSS: it's shorter and clearer. You need XPath when you have to go up to the parent element or take a neighboring table cell by text — CSS has no way to do that.
The selector returns “Code: 12345”, but I only need the digits. What do I do?
That's no longer the selector's job. The same rule row has a “Regular expression” column — it extracts a part of the found value. Next to it, “Find” / “Replace” and “Text to clean up” work if a simple replacement is enough.
How do I check a selector without running the whole collection?
The rule row has a test button: it opens the page whose address you entered in the “Test Link” column and shows what the selector returned. If the address column is empty, the button just does nothing, with no message.
Where it is and who has access
- Menu
- Directories → Processing price lists → List of price lists
- Where to enter it
- the “Site parser” row → “Setup” → the “Import settings” tab
- Access right
- the “Price lists” window
Only the universal parser has this tab. You enter the selector in the “Selector #1” cell of the row for the field you need — it's saved right away, there's no “Save” button. How the rules grid works and how to check a selector with a test is covered in How to set up page parsing rules.
Related topics
- For the overall picture of collecting data from websites — Site parsing.
- If the selector is ready and you need to check it with a test — How to set up page parsing rules.
- To find out which fields can be collected at all — What exactly the parser takes from a product page.
