Reputation: 1415
I cannot find input type number element from https://github.com/watir/watir/wiki/HTML-Elements-Supported-by-Watir
Does this mean watir cannot locate such HTML element?
Upvotes: 1
Views: 2565
Reputation: 46846
Watir (both classic and webdriver) support the input of type number as text fields. You can locate it like you would any other text field.
For example, say the html is:
<input type="number" name="quantity" min="1" max="5">
Then you can do the following to check that the element exists (or any other action):
browser.text_field(:name => 'quantity').exists?
#=> true
If you only want to find elements based on their type attribute being "number", then you will have to use the :css or :xpath locator:
browser.element(:css => 'input[type=number]').exists?
#=> true
browser.element(:xpath => '//input[@type="number"]').exists?
#=> true
Upvotes: 4