Image Search
This node helps me find the desired image on a website, and then I can perform actions on the images found.
Note
Note: This block only works well when running simultaneously on fewer than 10 profiles
Mode
I can select the image type by file path or Base64 format
Find in full page
When using this option, I can Image Searchs even if they are on the page but not displayed on my screen
Get Multiple Results
Retrieve all images that match the sample image
X Coordinates Output Variables
Save the X coordinate of the found image to the desired variable.
Y Coordinates Output Variables
Save the Y coordinate of the found image to the desired variable.
Timeout (seconds)
The maximum time to run this node. 0 to not timeout
Practical Example
Case Single Image
Examle
Here, I’ll take an example of using the node to find an image in the game Pixel
In this case, I want to move to the watermelon icon
First, I need to capture the watermelon image, then configure the Image Search node as follows
Next, to make the character move to the watermelon based on the returned coordinates, I’ll use the Click element
node with the Down
action
Now, I’ll run this process to see if the character can move to the watermelon
As you can see, the character has moved to the watermelon
Case Multiple Image
Example
Here, I am looking to find plots of land that already have fruit and then harvest them.
First, I will configure the Image Search
node to search for plots of land with fruit as follows.
The result will return two variables, x
and y
, containing the coordinates of the plots with fruit that need to be harvested.
Next, configure the Insert Data node to create a variable named order
with a value of 0
.
Then, configure the Click Element node to click on the scissors icon using the selector [class^="Hud_itemList"]>div
Next, configure the Click Element node to click on the coordinates of the plots with fruit using the expression {{variables.x.[variables.order]}},{{variables.y.[variables.order]}}
. For clarity, when the order variable is 0, it will take the first coordinates from the array of x and y coordinates of the plots with fruit.
Next, configure the Insert Data node to check the number of plots with fruit found by the Image Search
node. Then, subtract 1 from that value to use in the Repeat Task node (since the first interaction has already been performed, it will be subtracted once).
Finally, configure the Insert Data node to move to the coordinates of the next plot in the returned coordinates array.
The script will then include the following nodes.
When the script is run, it will harvest all the fruit and then end the script.