Describe the bug
Wanted to create a Touch Bar button that would execute JS in browser but can not get it working. I add new button and select "Run Apple Script" (have tried with both asyc and background) and use this code for Safari
tell application "Safari"
open location "https://google.com"
do JavaScript "alert('lala')" in document 1
end tell
and this for Chrome
tell application "Google Chrome"
open location "https://google.com"
execute javascript "alert('lala');"
end tell
However nothing happens. Have played around and tried every possible code snippet on the web but can not get to execute any JS.
Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
Touch Bar
Screenshots
Device information:
- Type of Mac: MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports), 2,9 GHz Intel Core i5, 8 GB 2133 MHz LPDDR3
- macOS version: 10.12.6 (16G1510)
- BetterTouchTool version: 2.645