On Saturday, March 2, 2013 2:57:44 AM UTC-8, Jarmo Pertman wrote:

> You can usually use whatever attribute is already valid in html. "name" 
> for tables, as far as i know, is not a valid attribute for example.
>
> You can get a rough estimation of the available attributes at w3 site[1]. 
> For example, if you look at the table element[2], then it supports "border" 
> and "global attributes". When you look at the global attributes[3], then 
> "name" is not listed there.
>
> There might be of course differences between html4 and html5. In short - 
> if you're using some attribute in your html markup and it is a valid 
> attribute for that element, then just trying it out in watir should work. 
> If it does not, then feel free to open up an issue in watir-classic[4] or 
> watir-webdriver[5] repository respectably.
>
> Jarmo Pertman
> -----
> IT does really matter - http://itreallymatters.net
>
> [1] http://www.w3.org/TR/html-markup/elements.html
> [2] http://www.w3.org/TR/html-markup/table.html#table
> [3] http://www.w3.org/TR/html-markup/global-attributes.html
> [4] https://github.com/watir/watir-classic/issues
> [5] https://github.com/watir/watir-webdriver/issues
>
> On Saturday, March 2, 2013 3:03:11 AM UTC+2, Justin Ko wrote:
>>
>> As far as I can tell, the code checks against the "attribute_list" to 
>> determine if the attribute is valid. You can see the list for a specific 
>> element type by doing:
>>
>> browser.element.class.attribute_list
>>
>> where "element" can be any element type (text_field, link, div, etc.). I 
>> believe it is auto-generated some how.
>>
>> Justin Ko
>>
>>
>>
>> On Friday, March 1, 2013 1:04:25 PM UTC-5, Chuck van der Linden wrote:
>>>
>>> We used to have a big chart, which listed all the elements, and what 
>>> could be used to identify them, but it was hard to keep up to date, and I'm 
>>> not sure it's around, linked, or up to date if it is.  
>>>
>>> Is there a simple way (perhaps it has escaped me) to know (perhaps via 
>>> the rubydocs) what things can be used to select an element?
>>>
>>> for example 
>>>  browser.text_field(:name => "foo")  #valid
>>>  browser.tables(:name => "foo")  # results in: invalid attribute: :name 
>>> (Watir::Exception::MissingWayOfFindingObjectException)
>>>
>>> If I look up the tables method in the rubydoc, all I see is  tables 
>>> (*args)   how can I tell what a valid arg is?
>>>
>>> Thanks, (and Justin also).  Yeah I know I can try trial and error, it's 
just that sometimes I'd rather be able to just 'look it up' hence the 
question if this is documented someplace.  Also I know that :name is not 
valid for tables, which is why I used it in the example, it's the sort of 
thing someone MIGHT get used to using, and nothing prevents a developer who 
is trying to be helpful from adding a 'name' attribute to a table.. (even 
if it is technically bad html and all) and a tester from then trying to use 
it to identify the table.

What then happens 'feels' like an inconsistency (when actually it's just us 
trying to honor the HTML spec), and again leads back to the new watir user 
wondering what the rules are for which attributes are supported for which 
elements.. (which is why a lot of us, when I started using watir years ago, 
had that chart of (identification)methods by element printed out and pinned 
to the wall in our workspaces.  

Actually Justin's command  (browser.element.class.attribute_list) seems 
intriguing, but the output is not entirely human friendly, and seems to 
include a lot of events etc.  Here's an example of what it gave for table.
1.9.3-p125 :005 > b.table.class.attribute_list
 => [:caption, :t_foot, :t_head, :rows, :t_bodies, :align, :bg_color, 
:border, :cell_padding, :cell_spacing, :frame, :rules, :summary, :width, 
:access_key, :access_key_label, :command_icon, :command_label, 
:command_type, :content_editable, :dir, :item_id, :item_value, :lang, 
:title, :command_checked, :command_disabled, :command_hidden, :draggable, 
:hidden, :item_scope, :spellcheck, :translate, :context_menu, :dataset, 
:dropzone, :item_prop, :item_ref, :item_type, :onabort, :onblur, :oncancel, 
:oncanplay, :oncanplaythrough, :onchange, :onclick, :onclose, 
:oncontextmenu, :oncuechange, :ondblclick, :ondrag, :ondragend, 
:ondragenter, :ondragleave, :ondragover, :ondragstart, :ondrop, 
:ondurationchange, :onemptied, :onended, :onerror, :onfocus, :oninput, 
:oninvalid, :onkeydown, :onkeypress, :onkeyup, :onload, :onloadeddata, 
:onloadedmetadata, :onloadstart, :onmousedown, :onmousemove, :onmouseout, 
:onmouseover, :onmouseup, :onmousewheel, :onpause, :onplay, :onplaying, 
:onprogress, :onratechange, :onreset, :onscroll, :onseeked, :onseeking, 
:onselect, :onshow, :onstalled, :onsubmit, :onsuspend, :ontimeupdate, 
:onvolumechange, :onwaiting, :properties, :style, :tab_index, :id, 
:class_name] 
1.9.3-p125 :006 > 

I have to wonder if I can actually use any or all of those (:onblur ? 
really?) to identify a table element

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to