| Watir method | HTML tag | :action | :after? | :alt | :class | :for | :href :url | :html | :id | :index | :method | :name | :src | :text | :title | :value | :xpath | Multiple Attributes |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| area | <area> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| button | <button> <input type="button"> <input type="image"> <input type="reset"> <input type="submit"> | |
|
|
|
|
|
|
|
|
|
|
If the input type is image |
|
|
|
|
|
| cell | <td> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| checkbox | <input type="checkbox"> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| dd | <dd> | |||||||||||||||||
| div | <div> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| dl | <dl> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| dt | <dt> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| em | <em> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| file_field | <input type="file"> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| form | <form> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| frame | <frame> <iframe> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| h1 h2 h3 h4 h5 h6 | <h1> <h2> <h3> <h4> <h5> <h6> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| hidden | <input type="hidden"> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| image | <img> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| label | <label> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| li | <li> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| link | <a> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| map | <map> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| p | <p> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| pre | <pre> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| radio | <input type="radio"> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| row | <tr> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| select_list | <select> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| span | <span> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| strong | <strong> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| table | <table> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| tbody | <tbody> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| text_field | <input type="password"> <input type="text"> <textarea> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ul | <ul> | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| New Browser Windows | n/a | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you want to ask Watir directly which HTML elements it knows about, execute this code (contributed by Bret Pettichord at watir-general, works only on Windows):
require 'watir/ie' def is_element_subclass? klass while klass = klass.superclass return true if klass == Watir::Element end end ObjectSpace.each_object(Class){|c| puts c if is_element_subclass?(c)}
You should get this (for Watir 1.6.5):
Watir::Link Watir::Image Watir::TableCell Watir::TableRow Watir::TableBody Watir::TableBodies Watir::Table Watir::CheckBox Watir::Radio Watir::RadioCheckCommon Watir::FileField Watir::Hidden Watir::TextField Watir::Button Watir::SelectList Watir::InputElement Watir::Em Watir::Strong Watir::Dd Watir::Dt Watir::Dl Watir::H6 Watir::H5 Watir::H4 Watir::H3 Watir::H2 Watir::H1 Watir::Ul Watir::Li Watir::Label Watir::Area Watir::Map Watir::Span Watir::Div Watir::P Watir::Pre Watir::NonControlElement Watir::Form