Module: WdaClient::Screenshot
- Included in:
- WdaClient
- Defined in:
- lib/wda_client/screenshot.rb
Instance Method Summary collapse
Instance Method Details
#take_screenshot(to_file: './snapshot.png') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wda_client/screenshot.rb', line 6 def take_screenshot(to_file: './snapshot.png') req = generate_base_req(method: :get, url_path: '/screenshot') res = Net::HTTP.start(@base_url.host, @base_url.port) { |http| http.request(req) } parsed_result = JSON.parse res.body File.write to_file, Base64.decode64(parsed_result['value']) parsed_result['output'] = to_file parsed_result end |