How to launch Hangouts Chrome extension via AppleScript? I am trying to launch a Google Chrome extension in AppleScript or Terminal. By "launch," I mean replicate the act of clicking on the extension icon found in Chrome's toolbar.

The Chrome extension in question is Google Hangouts. Clicking on the extension icon creates a new pseudo-window in Chrome that houses the Hangouts dialer.



Here is what I've considered:


I uncovered the physical location of this extension on my hard drive: 


/Users/Me/Library/Application Support/Google/Chrome/Default/Extensions/ nckgahadagoaajjgafhacjanaoiihapd/2018.123.418.2_0
However, I didn't find anything of significance.

I entered chrome-extension://nckgahadagoaajjgafhacjanaoiihapd/ in Chrome's address bar, which led to a "Your file was not found" message.
I do not know of a way to associate a keyboard-shortcut with the Hangouts extension. The Options item in the context menu of the Hangouts extension is not selectable (i.e., it is greyed out).
The Hangouts extension has a second shortcut, found in the systemwide, top menu bar. I tried programmatically clicking on the menu-bar icon with code like this (source):


tell application "System Events" to tell process "SystemUIServer" to tell (menu bar item 1 of menu bar 1) to click
But, I am unable to get AppleScript to click on any icon that falls to the left of the wifi symbol.

I am aware that Hangouts has a web interface (https://hangouts.google.com). However, any phone number that is given to the web interface is dialed by the extension (not by the web interface itself). So, interacting with the extension directly is more ideal.




Is the dreaded mouse-click simulation the only way to accomplish what I want?
This works for me in macOS High Sierra:

if running of application "Google Chrome" then
    tell application "System Events" to click menu bar item 1 of menu bar 2 of application process "Chrome"
else
    tell application "Google Chrome"
        activate
        tell active tab of front window
            repeat while (loading)
                delay 0.2
            end repeat
        end tell
    end tell
    tell application "System Events" to click menu bar item 1 of menu bar 2 of application process "Chrome"
end if




Note: The example AppleScript code is just that and does not employ any error handling and is meant only to show one of many ways accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.