Click on a certain element depending on the color

I am working on a chat communication with a robot , the robot is able to read and answer on the chat , but i am having an issue while closing the conversation window after answering, by default it closes the first user (existing on the left side).
I want to trigger , depending on the color ( dark in my case) , if it is dark (means that this is the opened conversation after answering) , so it has to close that one by clicking on the (X).
Any idea how to do that, or is there any other solution , even if it does not depend on the colorChat ?

1 Like