Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automate simple & repeated browser tasks

Automate simple & repeated browser tasks

はじめての英語プレゼン #4
https://english-lt.connpass.com/event/67958/

Tadashi Nemoto

October 25, 2017
Tweet

More Decks by Tadashi Nemoto

Other Decks in Programming

Transcript

  1. Many repeated browser tasks • Give member account • Get

    image of graph & send to Slack • Get specific data in page • Download file from page • Fill form same content • etc
  2. Use headless chrome • Either need when running selenium in

    non display environment • Virtual display • Xvfb, Xdummy • Headless browser • PhantomJS, Chrome 59
  3. Using headless chrome is easy • Installing chromedriver via gem

    https://github.com/flavorjones/chromedriver-helper
  4. Easy to write code for browser automation • driver.get ‘https://www.google.co.jp’

    • driver.find_element(:id, ‘hoge’).click • driver.find_element(:id, ‘hoge’).send_keys ‘hoge’ • driver.find_element(:id, ‘hoge’).text • driver.save_screenshot(‘path/to/screenshot.png’)