Selenium Webdriver ruby​​ 升级(write_timeout 错误)

2024-01-08

我正在尝试从 ruby​​ 2.4.4 升级到 ruby​​ 2.6.1,但我的支持 Javascript 的黄瓜测试都不起作用。运行黄瓜测试时出现以下错误:

      unknown keyword: write_timeout (ArgumentError)
      ./features/support/env.rb:58:in `block in <top (required)>'
      ./features/support/sign_in_step_helper.rb:4:in `sign_in'
      ./features/step_definitions/session_steps.rb:2:in `"I log in"'
      features/quote_wizard/quotes_wizard.feature:40:in `When I log in'

write_timeout在整个项目的任何地方都不存在。

这就是我的features/support/env.rb(自动生成的评论被抑制):

require 'simplecov'
require 'cucumber/rails'
require 'capybara'
require 'capybara/dsl'
require 'capybara/cucumber'
require 'cucumber/rspec/doubles'
require 'selenium-webdriver'
require_relative './download_helper
SimpleCov.at_exit do
  puts 'Simplecov complete'
end

Capybara.default_max_wait_time = 5 

Capybara.register_driver :chrome do |app|
  options = Selenium::WebDriver::Chrome::Options.new(
    args: %w[no-sandbox disable-extensions headless] # Remove `headless` to view test runs in browser
  ) 
  options.add_argument('--window-size=1920,1080')
  options.add_preference(:download,
                         directory_upgrade:   true,
                         prompt_for_download: false,
                         default_directory:   DownloadHelper::DEFAULT_DIR)

  options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })

  driver = Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)

  bridge = driver.browser.send(:bridge)

  path = '/session/:session_id/chromium/send_command'
  path[':session_id'] = bridge.session_id

  bridge.http.call(:post,
                   path,
                   cmd:    'Page.setDownloadBehavior',
                   params: {
                     behavior:     'allow',
                     downloadPath: DownloadHelper::DEFAULT_DIR
                   })
  driver
end

Capybara.javascript_driver = :chrome

ActionController::Base.allow_rescue = false

:truncation instead.
begin
  DatabaseCleaner.strategy = :transaction
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

require 'constant_tables'
ConstantTables.load!
Cucumber::Rails::Database.javascript_strategy = :truncation, { except: ConstantTables.table_names }
World(FactoryBot::Syntax::Methods)

编辑:这是 Gemfile 的测试部分

group :development, :test do
  gem 'parallel_tests'
  gem 'site_prism'
  gem 'capybara-email'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
  gem 'factory_bot_rails'
  gem 'rspec-rails'
  gem 'rubocop-rails'
  gem 'rubocop-rspec'
  gem 'selenium-webdriver'
  gem 'shoulda'
  gem 'timecop'
  gem 'chronic'
  gem 'sinatra', '~> 2.0.0.rc2'
  gem 'simplecov', :require => false
  gem 'paratrooper', '3.0.2'
  gem 'platform-api', '2.0'
  gem 'activerecord-import'
  gem 'rb-readline'
end

我认为你应该升级你的宝石,看看这个:

webmock https://github.com/bblimke/webmock/blob/master/CHANGELOG.md

他们特别添加了对 ruby​​ 2.6 的支持,也许值得一试?你检查过其他人吗?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Selenium Webdriver ruby​​ 升级(write_timeout 错误) 的相关文章

  • 不使用 RVM 时的 Cron +

    我使用的是RVM环境 RUby 版本 2 1 2 导轨 4 1 1 schedule rb every 1 minute do runner note send mail end I used whenever update crontab
  • 前面的冒号:YAML 语法

    我目前在项目中使用 Sidekiq 并且有以下 YAML 配置文件 concurrency 5 pidfile tmp pids sidekiq pid logfile log sidekiq log staging concurrency
  • 未定义符号:尝试运行瘦网络服务器时的 SSLv2_method

    我已经用 rvm 安装了 OpenSSL rvm pkg install openssl 然后做了rvm reinstall 1 9 3 with openssl dir rvm path usr 当我尝试运行瘦网络服务器时 出现以下错误
  • 如何在Python + Selenium中获取元素的值

    我在我的 Python 3 6 3 代码中得到了这个 HTML 元素 作为 Selenium网页元素当然 span class ocenaCzastkowa masterTooltip style color 000000 alt 5 sp
  • javascript - Twitter bootstrap jquery 插件未编译用于生产

    我正在使用 Twitter Bootstrap 开发 3 1 Rails 应用程序塞胡纳克的宝石 https github com seyhunak twitter bootstrap rails 在生产模式下 我可以通过管道预编译使用基本
  • 将 UTF-8 设置为 Heroku 中的默认字符串编码

    我需要在 Heroku 中将默认的 ruby 字符串编码更改为 UTF 8 由于某种原因它是 US ASCII heroku console Ruby console for myapp heroku com gt gt a encodin
  • Delayed_job不会运行用户定义的方法

    我一直在尝试让 DelayedJob 在后台运行一些用户定义的方法 对于这个测试用例 我在助手中定义了以下方法 def test case u User new u first name JimBob u last name joe u e
  • 相当于 JavaScript 中 Ruby 的each_cons

    许多语言都曾提出过这个问题 但 javascript 却没有 Ruby 有方法Enumerable each cons https devdocs io ruby 2 5 enumerable method i each cons看起来像这
  • Rails 教程 - User.rb 文件错误

    我正在关注 Railstutorial org 第 7 章 我正在尝试运行该应用程序 但出现以下代码错误 该错误表明我需要在文件末尾添加另一个 结束 但我已经尝试过此操作 但没有成功 错误是 Users woshea rails sampl
  • 使用 Selenium 从 twitter 抓取动态推文

    这可能看起来像一个重复的问题 但相信我 我在 Twitter 上观察到了一些新东西 我之前制作了一个 Twitter 抓取工具 它使用滚动和等待动态元素来获取给定数量的推文 但现在好像不行了 它不会抓取超过 10 条推文 此外 它抓取的推文
  • Grails(现在)值得吗? [关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 我知道这是一个复制 https stackoverflow com questions 397228 is grails worth it然而
  • 无法在 Windows 7 上安装 Rmagick 和 Imagemagick

    当我跑步时gem install rmagick 2 13 1 gem从 rmagick 2 13 1 gem 所在的目录中 我收到一个错误 指出它无法构建 gem 本机扩展 下面显示 c Ruby192 bin ruby exe extc
  • 如何使用 ANSI 转义序列捕获 bash 中终端窗口的标题?

    我在 OSX 中使用 bash 命令行 我知道 ANSI 转义序列 033 21t 将检索当前终端窗口的标题 因此 例如 echo ne 033 21t sandbox Where sandbox is the title of the c
  • 从邮件程序访问助手?

    我试图从 Rails 3 邮件程序访问帮助程序方法 以便访问会话的当前用户 我将 helper application 放在我的邮件程序类中 这似乎可以工作 但其中定义的方法对我的邮件程序不可用 我收到未定义的错误 有谁知道这应该如何运作
  • #文档是什么意思?

    这是我的 HTML 文件 我正在尝试使用Selenium Webdriver API随着Chrome驱动程序 to send keys to an input归档内 但我无法访问其中的任何内容 document 我不明白为什么 有人可以告诉
  • 无法使用 gem 添加源

    我正在尝试添加http rubygems org http rubygems org 在我的来源中 因为我无法使用 gem install NAME 此错误 无法在任何存储库中找到有效的 gem dashing gt 0 所以 我执行了这个
  • Selenium 网页抓取与动态内容和隐藏数据表上的美丽汤

    真的需要这个社区的帮助 我正在使用 Selenium 和 Beautiful Soup 对 Python 中的动态内容进行网页抓取 问题是定价数据表无法解析为 Python 即使使用以下代码 html browser execute scr
  • Rspec 通过 mTurk 测试实时结果

    我正在通过 Rspec 测试代码在 mTurk 上创建点击 但同时我需要测试必须从 mTurk 发回的结果 为了节省每次测试的复杂性 我使用 VCR 将 HTTP 请求记录在盒式磁带中 我该如何实施这个测试 好吧 我为此做了一些修改 我使用
  • 我可以在同一台 Apache 服务器上运行 Python Django 和 Ruby 吗?

    我正在使用 ModWSGI 在 Apache2 上运行 Python Django 并且我想在同一台服务器上运行 Ruby on Rails 可以这样做吗 我读到 Passenger for Ruby on Rails 也可以支持 Djan
  • webdriver-manager 10.2.9 上的语法错误

    发帖自问题 170 https github com angular webdriver manager issues 170 更新到最新版本后 运行 webdriver manager 命令时出现以下错误 C Users user App

随机推荐