safari-ctl

A Command Line Tool to control Safari for MacOS. (Browsing/FillingForm/GetSetCopyURL/JavascriptInjection/GetTitle/Search)


Keywords
safari, javascript, injection, URL, automatic, automation, browsing, copy, fill, form, clik, command-line, command, line, commandline, tool, cli
License
MIT
Install
npm install safari-ctl@0.2.0

Documentation

safari-ctl - Command Line Tool To Control Safari for MacOS

A Command Line Tool to Control Safari for MacOS. (Browsing/FillingForm/GetSetCopyURL/JavascriptInjection/GetTitle/Search)

### Get current URL on Safari

$ safari-ctl
https://github.com

### Copy current URL on Safari to the clipboard

$ safari-ctl -s

### Navigating by command line

$ safari-ctl -m
# marks all <a> with numbers

$ safari-ctl -a 32
# click 32'th <a>

$ safari-ctl -b
# history back

### Filing form

$ safari-ctl -M
# marks all <input> with numbers

$ safari-ctl -A 0 -I 'Japan'
# Fill 0th input with 'Japan'

$ safari-ctl -A 1
# click 1st input button

### Javascript Injection

$  safari-ctl -j 'document.getElementById("sb_form_q").value="Japan"'
Japan

Install

npm i -g safari-ctl

You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use some features.

@PARTPIPE@|dist/cli.js -h

You can see detail usage on npmjs.com

@PARTPIPE@

Change Log

  • 0.1.x: beta release
  • 0.2.0: suppress result at anchor click/history forward/scroll

Idea

  • marking buttons