ruby - Selenium 在 chrome 84 中打开一个空白页,在 83 中工作正常
问题描述
我有以下代码在 chrome 83 中运行良好:
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument("--disable-dev-shm-usage")
@invitation = Invitation.last
driver = Selenium::WebDriver.for :chrome, options: options
driver.manage.window.resize_to(*@invitation.dimensions)
driver.manage.timeouts.page_load = 10
driver.manage.timeouts.implicit_wait = 10
driver.navigate.to invitation_image_url(@invitation.id, auth_token: @invitation.signed_id)
puts driver.page_source
现在,当我更新到 chrome 84 时,puts 返回一个空白页面而不是正确的页面:
"<html><head></head><body></body></html>"
为什么会发生,我如何让它在 chrome 84 中工作?
解决方案
当您更新 chrome 浏览器版本时,您应该根据该浏览器版本 https://chromedriver.chromium.org/downloads使用确切的 chromedriver 版本。在此链接中,您可以根据浏览器版本下载 chromdwriver exe(更改驱动程序后请刷新项目并运行它)
推荐阅读
- python - 得到一个 keyerror '项目'
- spring - Spring IMAP Poller 在延迟几个小时后读取电子邮件
- python - 来自 any() 和 all() 函数的意外结果,以及如何将字符串读取为假?
- c# - Web 配置中的动态路由处理
- wordpress - 使用 Elementor,如何在其他元素周围环绕文本?
- python - python logging - 特定功能的不同级别
- performance - 分页性能
- robot - 如何让机器人辣椒始终保持在一个位置或姿势?
- javascript - Google Save To Drive API v3 停止工作
- javascript - 构建随机团队生成器的最佳方法