Selenium can't find fields with type number

前端 未结 2 1035
迷失自我
迷失自我 2021-01-23 17:52

I\'m having a problem getting Cucumber to find fields with the HTML5 type=\"number\". I\'m not a big fan of the way they look in the browser, but I have a few field

2条回答
  •  深忆病人
    2021-01-23 18:44

    Ok, I have found firefox has an option to disable number input field support: 'dom.forms.number'.

    So if you add the following lines in your env.rb, number input gets disabled and tests work again.

    Capybara.register_driver :selenium do |app|
      profile = Selenium::WebDriver::Firefox::Profile.new
      profile["dom.forms.number"] = false
      Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
    end
    

提交回复
热议问题