'AppleScript error when trying to get URL from Opera browser
I have a page opened in Opera browser and I'm trying to get its URL from terminal.
I've managed to do it like this:
osascript -e 'tell application "System Events" to return value of text field "Address field" of first group of text field "Address bar" of toolbar "Navigation" of group "Browser contents" of second group of first group of front window of application process "Opera"'
It works, but it requires access to System Events and Accessibility permission set. I'd like to access Opera directly like in this solution for Google Chrome. So I've tried to rewrite it like this:
osascript -e 'tell application "Opera" to return value of text field "Address field" of first group of text field "Address bar" of toolbar "Navigation" of group "Browser contents" of second group of first group of front window'
But got an error:
49:56: syntax error: A “"” can’t go after this identifier. (-2740)
Any ideas how to fix it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
