ruby - Chromedriver 不允许在 Windows 上使用 jruby 的无头模式 - Childprocess 错误
问题描述
这是代码
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 (ruby 2.0)
selenium-webdriver 3.12.0 (latest)
chromedriver 2.38 (latest)
windows 7
解决方案
推荐阅读
- android - 与源代码一起发布 Android Kotlin 库
- python - 将类的内部命名空间作为字典返回
- javascript - 在 .NET Core MVC 中访问 Cookie 时,它的值显示为 null
- amazon-web-services - 如何选择正确的 AWS Elastic Beanstalk 实例类型和数量?
- javascript - 将 Svelte 与 Stencil 组件一起使用
- google-sheets - 如何使用 arrayformula 创建多个不同长度的序列
- r - 需要帮助将 [160x3] 矩阵中的元素转换为 r 中的对象以使用 ggplot 制作热图
- azure-databricks - 获取 DataBricks 笔记本运行 id
- flutter - 由于参数类型“Function”无法分配给参数类型“void Function()”,因此无法创建 ontap 函数怎么办?
- pandas - 重命名熊猫中的标签名称