-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
25 lines (19 loc) · 787 Bytes
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true
require 'capybara'
require 'selenium-webdriver'
Capybara.configure do |capybara_config|
capybara_config.default_driver = :selenium_chrome_headless
end
Capybara.register_driver :selenium_chrome_headless do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
Capybara.javascript_driver = :selenium_chrome_headless
@session = Capybara::Session.new(:selenium_chrome_headless)
# Please replace the example code below with your code.
@session.visit('https://www.yahoo.co.jp/')
sleep 5 # waiting for getting assets
@session.save_screenshot('./yahoo.png')