gpt4 book ai didi

ruby-on-rails - Ruby on Rails 未定义方法 `[]' 为 true :TrueClass Capybara & poltergeist

转载 作者:数据小太阳 更新时间:2023-10-29 08:12:22 25 4
gpt4 key购买 nike

在运行我的 worker 时,我不断收到 undefined method '[]' for true:TrueClass 的间歇性错误。一半的时间它会工作,然后另一个它只是因为这个错误而失败。这似乎只有在我尝试同时运行多个工作人员时才会发生,但他们并不是都在执行相同的任务......

    2014-04-02T08:00:02Z 48940 TID-oukh38lzc WARN: {"retry"=>true, "queue"=>"default", "class"=>"TrackerWorker", "args"=>[1151], "jid"=>"9cb5d0bd4519afda81e999ec", "enqueued_at"=>1396425476.576768, "error_message"=>"undefined method `[]' for true:TrueClass", "error_class"=>"NoMethodError", "failed_at"=>2014-04-02 08:00:02 UTC, "retry_count"=>0}
2014-04-02T08:00:02Z 48940 TID-oukh38lzc WARN: undefined method `[]' for true:TrueClass
2014-04-02T08:00:02Z 48940 TID-oukh38lzc WARN: /Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/poltergeist-1.5.0/lib/capybara/poltergeist/browser.rb:54:in `find'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/poltergeist-1.5.0/lib/capybara/poltergeist/driver.rb:114:in `find'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/poltergeist-1.5.0/lib/capybara/poltergeist/driver.rb:118:in `find_xpath'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/finders.rb:154:in `block in resolve_query'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/base.rb:77:in `synchronize'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/finders.rb:150:in `resolve_query'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/finders.rb:32:in `block in find'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/base.rb:81:in `synchronize'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/finders.rb:30:in `find'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/node/actions.rb:53:in `fill_in'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/session.rb:396:in `block (2 levels) in <class:Session>'
/Users/max/.rvm/gems/ruby-2.0.0-p353@rocket/gems/capybara-2.2.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'

我的worker的例子如下,不是很复杂。

    options = {
:js_errors => false,
}
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, options)
end
Capybara.default_driver = :poltergeist
Capybara.javascript_driver = :poltergeist
Capybara.default_wait_time = 20
Capybara.ignore_hidden_elements = true

begin
visit('/')
sleep 2
save_screenshot("/Users/max/Sites/rocket/screens/0.jpg", full: true)
sleep 2
fill_in "search", :with => 'testing'
sleep 2
save_screenshot("/Users/max/Sites/rocket/screens/1.jpg", full: true)
sleep 2
click_button "Search"
sleep 2
save_screenshot("/Users/max/Sites/rocket/2.jpg", full: true)
end

它将截取第一个屏幕截图然后失败。

最佳答案

这里有报道https://github.com/teampoltergeist/poltergeist/issues/482并且仍然开放。

关于ruby-on-rails - Ruby on Rails 未定义方法 `[]' 为 true :TrueClass Capybara & poltergeist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22808009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com