Click on Element based on Color

Hello!

I hope you are doing well!

I want to know if anyone have ever worked on picking element based on color. I want to click on the free slot on calendar which has color white. I have tried using the get element property but I couldn’t find any unique feature for it.

This is the image. You can see the available and not available slots. I want to click on the first available slot. In this below image its 19, but it will vary for every month, of course!

Thanks in advance!

Best Regards

1 Like

Hi @Muhammad_Hayyan , Is this calendar on the web?
you can do 31 screen of the days of the month, with the white background: if the bot not find the first pass to the second… and so on.
obviously there is no need to enter 31 “element exist” activities:

  • put a loop in the workflow. Now, go in your screens folder and call the pics “screen_day_x”. (x from 1 to 31)
  • Go into the loop and replace x with the loop variable and with an “element exist” determine if the day is free or not

To be faster, the loop variable can start from the current day, rather than 1

1 Like

Hi!

I get your method. But can you help me to make a flow for this. Just for the one you described in your answer. I didn’t get how to make such flow and make it work.

Thank you in advance! :blush:

1 Like

3 Likes

I am doing web autuomation. Even now I didnt get what you want to say. So basically its online calendar where I have to select the day. I found out the way to select the first available slot but I want some method which is more efficient. The only way to achieve efficiency is to click on element based on color. I hope you understand my scenario.
Thank you for your efforts!

1 Like

@daniele_arcangeli I believe the correct condition is i <= 31, no?

1 Like

Hi @pedro.azevedo, excellent question:
i > 31 is correct, the loop running on the NO rather than YES condition. I have reversed them for more clarity. i <=31 would be ok if the cycle runs for positive condition!

2 Likes

Yes! You can make it work via click on element activity using the condition you have mentioned. You can also make it work via send hotkey activity.

2 Likes

Sorry haha now I see

1 Like

Hello!

A possible idea:

  • select an image (white rectangle with lower horizontal border and right vertical border)
  • find coordinates of this image (several images will be found)
  • analyze the coordinates, click on the first upper left found image

Best Regards

2 Likes

Hi!

Thanks for your response! Can you tell me how to uniquely identify the image? If we follow your case Bot will find multiple images. Can you explain in detail? I’ll defenitely give it a try then.

Regards

1 Like

Hi!

If the bot will find multiple images,
In this case will we get a set of coordinates for each image?

If we have a set of coordinates for each image,
we can make a loop (first we find the image on the top - we analyze coordinate y).
then we find the most left image (we analyze x coordinate)

Regards

1 Like

Hello!

Is it possible to get element property of the single day?
Is there any difference, if the day is available or not (except the color)?

Is it possible to get the full Xpath of the single day?

Regards

1 Like

Hi @Mikhail

I am so happy that you are taking so interest. Although I have completed the project but I am glad that you are on this topic so I really want to know if you have any way to solve this problem. like I am still working on this project if your solution turns out to be more efficient I am defenitely gonna use it.

Yes we can use get element activity. Infact I am using it in my case. It is difficult to find the unique ID for it. I tried the support team’s method, it is workin fine for me.

I still am not able, how to make your solution, of click on image work for me. But yes I am here to discuss that with you anytime. Feel free to share.

Have a great day!

Best Regards,
Muhammad Hayyan Khan

1 Like

Hi @Muhammad_Hayyan, could you please let us know your solution.

Hello!

Yes sure I am sharing it here. I would love if it helps anyone in this forum.

Below is the flowchart

Best Regards

1 Like