How can I use pagination function in n8n puppeteer node?

Hello,
Can anyone tell me how I can use the pagination function in n8n-nodes-puppeteer?

I am refering to this node: n8n-nodes-puppeteer - npm

p.s: since I am a newbie and don’t even know code so it would be helpful if you can help me out.

You can use the “Loop While Element Exists” option

  • When setting up the Puppeteer node in your n8n workflow:
    • Choose the “Loop While Element Exists” behavior.
    • Set the selector to something like the “Next” button (e.g. a.next, button[aria-label="Next"], etc.).
    • Inside the loop, add actions like “Get Text” or “Extract HTML”.

This keeps clicking “Next” until that button disappears. Hope this helps mate.

1 Like

@Abrar_Sami can you give code for this?

Yes sure. Here you go @Rafay_Saleem

{
“nodes”: [
{
“parameters”: {},
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [250, 300],
“id”: “1”
},
{
“parameters”: {
“url”: “https://example.com”,
“behavior”: “loopWhileElementExists”,
“selector”: “button[aria-label="Next"]”,
“actions”: [
{
“action”: “getText”,
“selector”: “.item”,
“outputProperty”: “itemTexts”
},
{
“action”: “click”,
“selector”: “button[aria-label="Next"]”
}
],
“noElementsBehavior”: “break”
},
“name”: “Puppeteer Pagination”,
“type”: “n8n-nodes-puppeteer.puppeteer”,
“typeVersion”: 2,
“position”: [500, 300],
“id”: “2”
}
],
“connections”: {
“Start”: {
“main”: [
[
{
“node”: “Puppeteer Pagination”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}