As a general rule, Watir tries to follow HTML as regards terminology. But i don't understand your suggestion.

On 2/25/06, Michael Bolton < [EMAIL PROTECTED]> wrote:
HTML doesn't have buttons; it has inputs with types of "image" or "button" or "submit".  I've never understood why WATIR doesn't track (at least via aliases) HTML's conventions: 
 
input(:img, "blah").click
 
input(:button, "foo").click
 
input(:submit, "bar").click

I can't tell whether you intend "blah", "foo" and "bar" to represent names or id's or text or something else. So this syntax can't work.

The parallel thing to do would be...

ie.input(:type, "image").click

Except that here we get no place to say which image button we want. One solution would be if watir allowed mulitple attributes, but so far it doesn't. And even still it runs into the problem that you want to have different methods for a file input than an image input than a checkbox. The most convenient and understandable way to do this is by representing these different kinds of things as separate classes (and factory methods) in Watir.

I think a more rational way to support these in Watir and follow the HTML structure would be to support factory methods (and classes) for every one of these different types. Thus:

Tag                    Watir 1.4          New

<input type=image>     button             image_input
<input type=text>      text_field         text_input
<input type=file>      field_field        file_input
<input type=submit>    button             submit_input
<input type=button>    button             button_input
<input type=checkbox>  check_box          checkbox_input
<input type=hidden>    hidden             hidden_input
<input type=password>  text_field         password_input
<input type=radio>     radio              radio_input
<input type=reset>     button             reset_input
<input type=textarea>  text_field         textarea_input

But even here i start to get confused, because looking at Watir's tests, as well as the HTML specs, the correct tag for textarea (a multiline input field) is <textarea> and yet the Watir code that supports as part of the TextField object actually looks for <input type=textarea>. And a similar confusing is also in play for <select> vs <input type=select-one> or <input type=select-multiple> and now i am wondering whether IE is transmogrifying the HTML from the one form to the other....

In any case, i would be happy to support a more logical system if i could actually get a logical explanation of what the HTML is that we need to support actually is (and why Watir's support for one thing actually works with another).

Of course we would continue to support the Watir 1.4 factory methods going forward regardless.

Bret

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to