storeImage - how to select right xpath and create a loop?

Hi guys,
I wanted to save 1000 of images from this website - https://opensea.io/collection/proof-moonbirds?search[sortAscending]=true&search[sortBy]=PRICE

The thing is - I don’t want to select 1000 images one-by-one and storeImage them
But the xpath looks the same for all of them (in my newbie opinion)
How to create a proper loop to avoid all this manual trickery?

You’ll need to upgrade to the proversion to go over the 25 XType per day limit. You might need to make some small adjustments depending on which browser and OS you’re using and you’ll need to swap out the savebutton_dpi_96.png with your own image. But the hard parts are done.

{
“Name”: “ImageGrab”,
“CreationDate”: “2022-4-23”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://opensea.io/collection/proof-moonbirds?search[sortAscending]=true&search[sortBy]=PRICE”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “bringBrowserToForeground”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “waitForPageToLoad”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “1”,
“Value”: “i”,
“Description”: “”
},
{
“Command”: “label”,
“Target”: “NextImg”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “sourceExtract”,
“Target”: “regex=(https\:\/\/lh3\.googleusercontent\.com\/[a-zA-Z0-9_=-]*)@${i}”,
“Value”: “imagelink”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${imagelink}”,
“Value”: “blue”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=open”,
“Value”: “${imagelink}”,
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “xpath=/html/body/img”,
“Value”: “#right”,
“Description”: “”
},
{
“Command”: “XType”,
“Target”: “${KEY_DOWN}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “Use different amounts of ${KEY_DOWN} depending on your browser and where Save As is positioned”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XType”,
“Target”: “${KEY_ENTER}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XType”,
“Target”: “image-${i}.png”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XDesktopAutomation”,
“Target”: “true”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “savebutton_dpi_96.png”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XDesktopAutomation”,
“Target”: “false”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “2000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “bringBrowserToForeground”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number(${i}) + 1;”,
“Value”: “i”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “image number is now ${i}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=close”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “gotoIf_v2”,
“Target”: “1 > 0”,
“Value”: “NextImg”,
“Description”: “”
}
]
}

1 Like