Need to find the X cross to delete a list item on a webpage

Hello,
I am new to KeyboardMaestro.
Here is what I need to do :

  • Activate Firefox window
  • Scroll down the window scrollbar
  • Find an image of an X (cross) => the delete button
  • Click on this button
  • Then find the image of the OK button => to confirm that I really want to delete
  • Click on the OK image
  • Pause a few miliseconds
  • Redo this sequence 3000 times

My problem is that I am unable to make the "Move and Click at (0,0) from the Center of the Found Image" stage work...

Can someone please help me ?

Thanks !

What is the precise problem? Is the image found? Is the mouse pointer moved there?

In fact I don't know...

When I run my macro, the Firefox window gets selected, the scroll of the window gets done. Then nothing happens. And I don't know how to debug...

But I am not sure I understand when I am doing the stage "Move and Click at (0,0) from the Center of the Found Image". Here is what I do

Is this sufficient and correct ?

Seems to be ok, if you want to click in the middle of the found image. Does the image appear green to indicate that it has been detected (because you have ”Display” checked)?

If you use a Retina display, you might want to try to clip the image into clipboard (cmd-ctrl-shift-4) and paste it into KM directly from there.

Does the (X) change its colour depending on the mouse position or some other factors?

If you move the slider to the right, you might be able to detect also pictures with slightly different colours although the risk of getting ”false positives” also increases.

What I usually do in the beginning of a macro in order to have a controlled browser window environment, is to position the window to the top left corner and resize it to some defined value.

After that, I usually don’t use ”the front window” but rather ”area” to avoid any false positives getting detected elsewhere on the screen.

Is this the purpose of the "Go" button ? => To test to see if KM can find the image ?
If yes, it doesn't find the image...

And what is the "Get" button for ? Seems it is always greyed out and I cannot use it.

Would you have time for a screensharing help ? Guess it woul be faster !

Yes, the "Go" moves to the position where it finds the image. If there is no match I get an alert message.
"Get" makes more sense for the other options than "found image's center" - after a countdown it gets the relative position values.

Do you have a Retina display? If yes, did you try my tip of clipping the searched picture directly over clipboard?

Don't think I have a retina display. I have a Mac Mini M1 with an acer K273 27" display 1920 x 1080. Nothing fancy. Just a random screen.

Anyway I don't understand how to perform your manipulation of clipping the searched picture directly over clipboard!

When the desired item is on the screen:

  • Press CMD-CTRL-SHIFT-4
  • Click and hold on one corner of the area to be searched for
  • Drag the pointer to the opposite corner and release the mouse button
  • (now you have copied that clip into your clipboard)
  • Go to Keyboard Maestro
  • Click on the "Image" square of the action
  • Paste the clipped picture into the square with CMD-P

Ah, I was doing that.
It's just that you used some terms that planted doubt in my mind.
Ok, so no luck, It simply doesn't find the image when I click on the go button.
Then if I play with the blurr slider, it finds images that have nothing to do with what I am looking for.
I was using the software Macro Recorder and was disapointed with the Find image feature. I seem to have no luck either with KM...

So I have another question : As the Find image fails in my case, is it possible to ask KM to look for a button that has a delete HTML label on it? Or something that is based on the HTML code and then find the coordinates and click on it ?

What are my option if I have an HTML page that displays a list with a column containing some delete buttons. I need to click on the first one in the column and then confirm that I really want to delete the element.

I'm joining the party late, but I see that your image to search for is 95% light grey and 5% dark grey. This can be a problem, especially if the search area is large. It would increase the chance of success dramatically if you added some additional colour to the search image. Is there anything outside that small area that you can include as part of the search image? Is there any chance that you can show a square inch of the screen around the X so we can give advice on what to search for?

I made for you a (narrated) demo Macro which:

  • opens a page in Firefox
  • positions and resizes the window
  • positions the cursor in the middle of the window
  • scrolls down until the end of the page is detected
  • clicks a link by finding it per clipped image
  • returns to the previous page with a keystroke

Does this macro work on your computer?

The images which I have clipped for that macro are the footer line of the page and the "What's new" link.

Firefox clicker demo.kmmacros (105.6 KB)

Thanks for chiming in to help Andrew, Airy. :slightly_smiling_face:

I tried finding the image which I copied from the picture which Andrew sent and it functioned quite reliably if I pushed the slider almost to the far left end. If the slider was in the default position, there were some false positives from other windows if I searched over the whole screen and not in a defined area.

Also I have previously tried Macro Recorder (and diverse other tools) but Keyboard Maestro really is by far the best solution I have found so far.

I haven't had any problems with the image detection after I found out that with a Retina display the screen clips which are made from screenshots somehow have a different resolution than those, which are made directly over the clipboard.

Since then: Absolutely no problems with the image recognition, whatsoever.

Because your actual problem seems to be in the actual image recognition, perhaps you might consider making another thread with a bit more focused title like "Image recognition problem with Mac Mini M1" or something like that.

Have you already tried searching the previous threads and the wiki regarding image recognition problems?

Here is what the list column looks like :
image

I need to click on the X (button) to delete the list elements.

Thanks a lot for your example macro.

So no, your example macro didn't work. It didn't find the end of page image. So it terminated.

Then I redone the image capture and pasted it in the stage image zone.
Same problem. Didn't find the image.

So is it my setup that has a problem ???
I really don't see why, my setup is real basic.

My KM had absolutely no problem detecting those. I adjusted the slider almost to the left end, though. I clipped the combination of both buttons as the search criteria to reduce the number of false positives.
image

Hi Waldbaer,
You said that when you click on the Go button and if KM doesn't find the image, it gives you back an error message.
Well, I don't have this behaviour. I click on the Go button, no area gets green => Guess it doesn't find the image, but I don't see any error message telling me that the image was not found.
Is it because I am using the demo version ??? Or is it a setting somewhere I need to do ?
My goal was to try and make it work before buying the software.

The error message is displayed if the macro is run and the action is set to notify on failures (one of the settings found through the cogwheel of the action).