Color Recognition with XClick Visual

hey,
i want to click on an element with a specific color (f.e. black). the element is changing it’s place after i reload the page. that said i can’t use xclick with xpath so i was trying to solve the problem by taking a screenshot of the element and use vision recognition.
unfortunately the xclick commands can’t distinguish different colors as you can see in the screenshot below.

any help is very much appreciated.
thanks everybody

I understand that the color selection box itself move. But inside the color selection, does the order of the colors remain the same? So e. g. “red” is always the 7th element from the top?

Also, on your screenshot, note that XClick does distinguish the colors. The best matching color should have the highest confidence and get selected. But I guess it does not work reliable as you have a few very much alike colors?

No, unfortantely they’re randomly changing places.

Also, on your screenshot, note that XClick does distinguish the colors. The best matching color should have the highest confidence and get selected. But I guess it does not work reliable as you have a few very much alike colors?

As you can see, my screenshot .png is black but it choosed the orange box (note the little arrow next to it).

As you can see, my screenshot .png is black but it choosed the orange box (note the little arrow next to it).

I notice the problem. Your input image is a mixture of black and white, so the black part is not considered soo important by the logic. Please try this:

  1. Make the input image a “pure black” image (= just the color you want to select)

  2. If this gives you wrong matches on other (black) parts of the page, then use visionlimitsearcharea or visionlimitsearcharearelative to limit the search area to just the color selection box (this also makes the search faster).

The first method helped!
Awesome,thank you.