I have the window of the picture above, save the configuration through stand-alone save, AppleScript can not click Save through click, the following script returns missing value, please ask in AppleScript, how to click static text
tell application "System Events"
tell process "WeChat"
click menu item "Proxy Settings..." of menu "WeChat" of menu bar 1
click radio button "Don't Use" of window "Proxy Settings"
delay 1
set focused to true
click static text "Save" of window "Proxy Settings"
end tell
end tell
```[enter image description here](https://i.stack.imgur.com/ZWJ9V.png)
tell application "System Events" tell process "WeChat" click menu item "Proxy Settings..." of menu "WeChat" of menu bar 1 click radio button "Don't Use" of window "Proxy Settings" delay 1 set focused to true click static text "Save" of window "Proxy Settings" end tell end tell
I don't have/use WeChat, so cannot examine the UI to confirm here, but
static textelements—generally speaking—don't often haveactionsattached to them ("AXPress"is the name of theactionthat theclickcommand aliases). From a design perspective,static textelements are intended as an inert label for some otherUI elementthat plays a functional role. In this case, it looks like abuttonelement, and its name is probably also"Save".buttonelements are also good candidates for attaching a whole bunch ofactionsto.Therefore, instead of:
you could try:
If that throws an error, it'll either be because the
buttonelement's name is not"Save", or the element is not abutton. But you can find out what it is like this:This will yield a reference to the object you're trying to click, by virtue of its
actionsnecessarily containing one named "AXPress" (i.e. it responds to theclickcommand), and its physical positioning almost certainly inferring it to be the last suchUI element.