Class: Browserctl::Commands::Click

Inherits:
Object
  • Object
show all
Defined in:
lib/browserctl/commands/click.rb

Class Method Summary collapse

Class Method Details

.run(client, args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/browserctl/commands/click.rb', line 8

def self.run(client, args)
  name = args.shift
  ref  = FlagExtractor.extract_opt(args, "--ref")
  selector = args.shift unless ref

  if ref
    abort "usage: browserctl click <page> --ref <ref>" unless name
    puts client.click(name, ref: ref).to_json
  else
    abort "usage: browserctl click <page> <selector>" unless name && selector
    puts client.click(name, selector).to_json
  end
end