How do I get an UI Element by ID from the application?

I have several Safari Windows, and the ID of one of them.
I want to do a click on it through System Events. To do that I need to tell the application “System Events” to get the element UI Element by ID and execute the click command.
I don’t know how to write that in Applescript
Thanks,
Regards

I don’t follow.
You have the ID of the window. DO you have a UI Element ID (like a button) or do you just want to click on the window to bring it frontmost?