prasmussen / chrome-cli

Control Google Chrome from the command line
MIT License
2.61k stars 89 forks source link

chrome-cli in crontab of MacOS may not work properly #74

Open shooter556 opened 1 year ago

shooter556 commented 1 year ago

Using "terminal" or even "remote terminal" (ssh) in macOS works just fine with chrome-cli. All you need to do is just click on "OK" when some privacy notification windows pops up. Then some entries will just appear in "Privacy" -> "Automation", indicating that some apps are allowed to access chrome's data directories. But when I try to add some script regarding "chrome-cli" in "crontab". (For example, just "chrome-cli chrome version" as simple as it is) It will just print (null) on screen or file.

Is there any workaround for this? I searched on the internet, unfortunately we can never add/remove apps manually in "Privacy" -> "Automation" configuration. What I guess is that all I need is adding "cron" in "Automation".

nagakirankys commented 4 months ago

As a workaround, add a LaunchAgent (that runs periodically) to dump the chrome-cli output to a file and let "cron" job read from this file. Have tried invoking "chrome-cli" from LaunchAgent is working fine.