Selenium can't find fields with type number

前端 未结 2 1059
迷失自我
迷失自我 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:50

    First off, I think you have some confusion regarding those frameworks. Cucumber is a BDD framework, which doesn't automate browsers in any way, so this question has nothing to do with it (This is why I removed it from your question title).

    Looks like you are using Capybara, which is an ATDD framework. You might probably consider showing us the Capybara code you use in order diagnose your problem.

    Under the hood, I assume you use Selenium WebDriver, I can confirm that Selenium works fine with (Tested with Firefox 28, which is the one selenium-webdriver (2.41.0) supports to).

    require 'selenium-webdriver'
    
    driver = Selenium::WebDriver.for :firefox
    
    DEMO_PAGE = <<-eos
      data:text/html,
      
    eos
    
    driver.get(DEMO_PAGE)
    driver.find_element(:tag_name, 'input').send_keys('25')
    

    So you might want to create a similar demo using Capybara to test this functionality.

    If the demo works, then we need take a closer look at your application. Othwewise, please raise a ticket for Capybara developers.

提交回复
热议问题