Random Image Search and Click
Posted: 02 Apr 2021, 00:44
Hi all, I am fairly new to scripting but have learned some basics through trial and error and reading topics on this site and archived posts via google searches and can usually get by alright. However, this one finally has me stumped. So, here goes:
The web page I need to be on generates the same image in random quantities but at a set time interval after being clicked. For instance you open the page and a random quantity like 3 images will pop up. You click one and then a second later, 5 images will pop up. Click one of those and then a second later 2 images will pop up and so on. Always the same exact images but usually in different positions on the page and different quantities.
How this normally works is you click on them with a mouse or tap the screen if you have a phone or tablet which is all well and good. But my problem is the only device I have to use at the moment is an old laptop with a touch pad and it is incredibly difficult to get the same speed and effectiveness as the other options. It is just too clumsy and burdensome to use for something like this.
So what I need to accomplish is a script that I can activate with a keyboard key that searches the page randomly (up, down, left, right, etc in different spots each time) for one image and then clicks it. Ideally it would work so that I strike the letter "B" or "N" or space bar, etc and could hit it again and again picking a different image in a random spot each time by using image search.
I was able to get as far as using image search and it finding the image and clicking on it once, but the location isn't random and I can't get it to repeat by clicking again. It always picks the first image on the screen every time which doesn't work because if the mouse cursor sits on it and the image lands in the same spot again after being clicked, the mouse cursor obstructs the image view and searching it won't detect the image or move on to find the next one. So every search pretty much has to locate the image in a different spot on the page when they move in order to avoid that. I also need to be able to keep repeating it by clicking the same keyboard key again if at all possible.
I hope this isn't too complicated or too long of a post to understand. Any help is very much appreciated on this
The web page I need to be on generates the same image in random quantities but at a set time interval after being clicked. For instance you open the page and a random quantity like 3 images will pop up. You click one and then a second later, 5 images will pop up. Click one of those and then a second later 2 images will pop up and so on. Always the same exact images but usually in different positions on the page and different quantities.
How this normally works is you click on them with a mouse or tap the screen if you have a phone or tablet which is all well and good. But my problem is the only device I have to use at the moment is an old laptop with a touch pad and it is incredibly difficult to get the same speed and effectiveness as the other options. It is just too clumsy and burdensome to use for something like this.
So what I need to accomplish is a script that I can activate with a keyboard key that searches the page randomly (up, down, left, right, etc in different spots each time) for one image and then clicks it. Ideally it would work so that I strike the letter "B" or "N" or space bar, etc and could hit it again and again picking a different image in a random spot each time by using image search.
I was able to get as far as using image search and it finding the image and clicking on it once, but the location isn't random and I can't get it to repeat by clicking again. It always picks the first image on the screen every time which doesn't work because if the mouse cursor sits on it and the image lands in the same spot again after being clicked, the mouse cursor obstructs the image view and searching it won't detect the image or move on to find the next one. So every search pretty much has to locate the image in a different spot on the page when they move in order to avoid that. I also need to be able to keep repeating it by clicking the same keyboard key again if at all possible.
I hope this isn't too complicated or too long of a post to understand. Any help is very much appreciated on this