Closing an iCloud Tab?

I would like to script the closing of a specific icloud tab of my choice.

Ideally, I’d prefer to do this without using GUI scripting.

Options tried so far…

1. Toolbar

In Desktop Safari you can enable a toolbar button “iCloud Tabs” which when clicked shows a list of the tabs currently open on your other devices.

If you hover one, an X appears which can be clicked to close the tab. When you next use Safari on the remote device that tab will be closed. If it’s already open and awake then the removal happens around one second later. It’s quick.

(But I did try GUI scripting and I can get to the row in the outline in the popup, but I can’t get the cross to appear to click it)

2. Start Page

they’re also listed on favorites:// “start page” but there are issues viewing all and no way to search them. There used to be until Safari 15.