HTML Extract and CSS Selector :nth-child issue

Quick question, any idea why this works but the next fails?

As I understand it this should do :nth-child(n+4), start at the 4th detected child element? Or am I miss understanding that?

This tester can help understand/debug your selector.

1 Like

yeah ive used that for logic, but doesnt help with real world testing

Please provide a way to reproduce to help troubleshoot.

if you take any html as an example are you able to do :nth-child(n+3) for example?

it only seems to accept a number not a calculation
(1) not (n+2)

Hey @RedPacketSec,

I tested it with a small workflow, and the CSS Selector :nth-child(n+3) works for me. Here’s the workflow that I created.

{
  "nodes": [
    {
      "parameters": {
        "url": "https://en.wikipedia.org/wiki/Main_Page",
        "responseFormat": "string",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "extractionValues": {
          "values": [
            {
              "key": "anchor",
              "cssSelector": "li a:nth-child(n+3)",
              "returnValue": "attribute",
              "attribute": "href",
              "returnArray": true
            }
          ]
        },
        "options": {}
      },
      "name": "HTML Extract",
      "type": "n8n-nodes-base.htmlExtract",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    }
  ],
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

must be me as the problem :wink: