这是代码
puts 'requiring selenium...'
require "selenium-webdriver"
# configure the driver to run in headless mode
puts 'initializing options...'
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
puts 'initiating driver..'
driver = Selenium::WebDriver.for :chrome, options: options
puts 'navigating to google.com...'
driver.navigate.to "https://google.com/"
puts 'adjusting window size'
driver.manage.window.resize_to(800, 800)
puts 'capturing screenshot...'
driver.save_screenshot "google.png"
启动驱动程序时,它会给出以下错误
ChildProcess::Error: Unknown error (Windows says "The operation completed successfully.", but it did not.)
环境
jruby 1.7(红宝石2.0)
selenium-webdriver 3.12.0(最新)
chromedriver 2.38(最新)
Windows 7