Selenium组合在元素\u id\u上引发错误

Selenium组合在元素\u id\u上引发错误,selenium,selenium-webdriver,Selenium,Selenium Webdriver,如果我尝试使用Selenium作为驱动程序而不是webkit,则会出现错误 如果驱动程序设置为:Capybara.current\u driver=:selenium\u chrome或Capybara.current\u driver=:selenium\u firefox 根调用是:单击“创建帐户”。但是,任何查找调用都会发生这种情况 TypeError: no implicit conversion of String into Integer # /Use

如果我尝试使用Selenium作为驱动程序而不是webkit,则会出现错误

如果驱动程序设置为:
Capybara.current\u driver=:selenium\u chrome
Capybara.current\u driver=:selenium\u firefox

根调用是:
单击“创建帐户”
。但是,任何查找调用都会发生这种情况

    TypeError:
      no implicit conversion of String into Integer
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/bridge_helper.rb:47:in `[]'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/bridge_helper.rb:47:in `element_id_from'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/remote/bridge.rb:606:in `block in find_elements_by'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/remote/bridge.rb:606:in `each'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/remote/bridge.rb:606:in `map'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/remote/bridge.rb:606:in `find_elements_by'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/search_context.rb:84:in `find_elements'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:69:in `find_xpath'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/node/base.rb:107:in `find_xpath'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/query.rb:110:in `block in resolve_for'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/node/base.rb:80:in `synchronize'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/query.rb:106:in `resolve_for'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/node/finders.rb:35:in `block in find'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/node/base.rb:84:in `synchronize'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/node/finders.rb:33:in `find'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/node/actions.rb:13:in `click_link_or_button'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-2.6.2/lib/capybara/session.rb:686:in `block (2 levels) in <class:Session>'
      # /Users/aaron/.rvm/gems/ruby-2.1.6/gems/capybara-angular-0.2.3/lib/capybara/angular/dsl.rb:8:in `block (2 levels) in <module:DSL>'
      # ./spec/features/pokitdok_pdpc_spec.rb:42:in `block (3 levels) in <top (required)>'
浏览器版本 Chrome:48.0.2564.109(64位) Firefox:44.0.2

Selenium 2.52.0应该是最新版本,足以涵盖这些内容

代码:

需要“spec\u helper”
描述“Pokitdok PDPC”,type::feature,js:true-do
让我来!(:payer){FactoryGirl.create(:payer,:pokitdok,name:'Mock payer')}
让我来!(:clinic\u population\u group){FactoryGirl.create(:clinic\u population\u group,population\u group:payer,public\u name:payer.name)}
让(:用户)做
{
名字:“合格”,看看PokitdokMock
姓:“病人”,看看PokitdokMock
}
结束
以前:每个人都做
Capybara.current\u驱动程序=:selenium\u chrome
访问“/”
结束
上下文“诊所”do
let(:clinic){clinic\u population\u group.clinic}
以前:每个人都做
生产环境
PokitdokMock.load_webmock
结束
它“根据准确数据注册PDPC付款人”do
单击“创建帐户”
结束
结束
结束
Gemfile.lock

capybara (2.6.2)
  addressable
  mime-types (>= 1.16)
  nokogiri (>= 1.3.3)
  rack (>= 1.0.0)
  rack-test (>= 0.5.4)
  xpath (~> 2.0)
capybara-angular (0.2.3)
  capybara (>= 2.5.0)
capybara-firebug (2.1.0)
  capybara (>= 1.0, < 3.0)
  selenium-webdriver
capybara-screenshot (1.0.11)
  capybara (>= 1.0, < 3)
  launchy
capybara-webkit (1.8.0)
  capybara (>= 2.3.0, < 2.7.0)
  json
chromedriver-helper (1.0.0)
  archive-zip (~> 0.7.0)
  nokogiri (~> 1.6)
rspec (3.4.0)
  rspec-core (~> 3.4.0)
  rspec-expectations (~> 3.4.0)
  rspec-mocks (~> 3.4.0)
rspec-core (3.4.3)
  rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
  diff-lcs (>= 1.2.0, < 2.0)
  rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
  diff-lcs (>= 1.2.0, < 2.0)
  rspec-support (~> 3.4.0)
rspec-rails (3.4.2)
  actionpack (>= 3.0, < 4.3)
  activesupport (>= 3.0, < 4.3)
  railties (>= 3.0, < 4.3)
  rspec-core (~> 3.4.0)
  rspec-expectations (~> 3.4.0)
  rspec-mocks (~> 3.4.0)
  rspec-support (~> 3.4.0)
rspec-support (3.4.1)
selenium-webdriver (2.52.0)
  childprocess (~> 0.5)
  multi_json (~> 1.0)
  rubyzip (~> 1.0)
  websocket (~> 1.0)
传入的id为:

{“cssSelectorsEnabled”=>true,“browserName”=>“firefox”、“handlesAlerts”=>true、“javascriptEnabled”=>true”、“nativeEvents”=>false、“platform”=>“Darwin”、“rotatable”=>false、“takesScreenshot”=>true、“version”=>“44.0.2”、“WebStorage Enabled”=>true、“applicationCacheEnabled”=>true、“databaseEnabled”=>true、“locationContextEnabled”=>true、,“acceptSslCerts”=>true}
该值来自
Selenium::WebDriver::Remote::Http::Common#call

请求动词、url、标题、负载
价值观

#不是作为散列传入的,只是为了打印目的
{
动词:post
网址:http://127.0.0.1:7055/hub/session/3c3f8527-5ef5-8b42-b5e4-C46BFDFFB4B78/元件
标题:{“接受”=>“应用程序/json”,“内容类型”=>“应用程序/json;字符集=utf-8”,“内容长度”=>“646”}
有效负载:{“使用”:“xpath”,“value”:“//a[./@href][((((./@id='Create account'或规范化空间(string()='Create account')或./@title='Create account'))或。//img[./@alt='Create account']]。//@type='submit或./@type='reset'或./@type='image'或./@type='button'][((./@id='Create account'或./@value='Create account')或./@title='Create account')][./@type='image'][./@alt='Create account'].//按钮[((./@id='Create account'或./@value='Create account'))或规范化空间(字符串()='Create account')或./@title='Create account')].//.//输入[./@type='image'][./@alt='创建帐户']'”}
}

您对驱动程序的定义是什么:硒和硒_firefox@TomWalpole添加到posthmmm中——除非您对selenium webdriver和浏览器之间的通信有任何干扰,否则没有任何线索——Capybaras测试通过了2.52.0版本的firefox?和chrome?@TomWalpole的测试远程网桥,而不是chrome或firefox网桥。我不知道这是否与任何事情有关。添加了浏览器
Capybara.register_driver :selenium_chrome do |app|
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

Capybara.register_driver :selenium_firefox do |app|
  Capybara::Selenium::Driver.new(app, :browser => :firefox)
end
capybara (2.6.2)
  addressable
  mime-types (>= 1.16)
  nokogiri (>= 1.3.3)
  rack (>= 1.0.0)
  rack-test (>= 0.5.4)
  xpath (~> 2.0)
capybara-angular (0.2.3)
  capybara (>= 2.5.0)
capybara-firebug (2.1.0)
  capybara (>= 1.0, < 3.0)
  selenium-webdriver
capybara-screenshot (1.0.11)
  capybara (>= 1.0, < 3)
  launchy
capybara-webkit (1.8.0)
  capybara (>= 2.3.0, < 2.7.0)
  json
chromedriver-helper (1.0.0)
  archive-zip (~> 0.7.0)
  nokogiri (~> 1.6)
rspec (3.4.0)
  rspec-core (~> 3.4.0)
  rspec-expectations (~> 3.4.0)
  rspec-mocks (~> 3.4.0)
rspec-core (3.4.3)
  rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
  diff-lcs (>= 1.2.0, < 2.0)
  rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
  diff-lcs (>= 1.2.0, < 2.0)
  rspec-support (~> 3.4.0)
rspec-rails (3.4.2)
  actionpack (>= 3.0, < 4.3)
  activesupport (>= 3.0, < 4.3)
  railties (>= 3.0, < 4.3)
  rspec-core (~> 3.4.0)
  rspec-expectations (~> 3.4.0)
  rspec-mocks (~> 3.4.0)
  rspec-support (~> 3.4.0)
rspec-support (3.4.1)
selenium-webdriver (2.52.0)
  childprocess (~> 0.5)
  multi_json (~> 1.0)
  rubyzip (~> 1.0)
  websocket (~> 1.0)