Response to Angrez Singh from message below
Thanks for the information it was helpful. It seems (if I'm understanding this correctly) that we have some non-standard HTML and that the developers shouldn't be trying to set the type attribute in the <Select> element explicitly, they should be using the multiple attribute if desired. I wonder though why when using the page directly IE seems to ignore this attribute and I can use the select list just fine, but when trying to use watir on the page it gets hung up on this attribute (i.e. the attribute prevents Watir from finding my object), if IE was truly the culprit wouldn't it have the problem when using the page outside of Watir as well? I was hopeful that even though the HTML is not standard that since IE appears to ignore this attribute, that maybe Watir should too? I tried changing the attribute to "select-one" and "select-multiple" in the page also, but Watir still couldn't find the object.
Response to Michael Bolton from message below
Thanks for the response, here is the Watir snippet that you requested with the irb response. Basically just trying to see if I can get a handle on the select list object in the page (tried with both :name and :id - only :id shown below, but the result is the same either way). When I do this and the attribute is included in the HTML, I get the error. If I remove the attribute from the HTML Watir finds the object with no problem. (I can use the select method to set the value once the attribute is removed as well)
$ie.select_list(:id, /order_source/).flash
Watir::Exception::UnknownObjectException: Unable to locate object, using id and
(?-mix:order_source)
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1928:in `assert_exists'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2020:in `flash'
from (irb):16
from ♥:0
irb(main):017:0> $ie.select_list(:id, /order_source/).flash
Watir::Exception::UnknownObjectException: Unable to locate object, using id and
(?-mix:order_source)
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1928:in `assert_exists'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2020:in `flash'
from (irb):17
from ♥:0
irb(main):019:0> $ie.select_list(:id, /order_source/).flash
=> nil(note: select list object flashes in IE as expected)
Re: [Wtr-general] Select List Question
Michael Bolton
Fri, 10 Feb 2006 13:25:47 -0800
Title: Select List Question
What did your Watir script's code look like? (Do I need to write a macro for this question?) Watir doesn't find objects; you ask it to help you find them. It's successful in helping you precisely to the extent that you've asked it in a way that it can understand. ---Michael B.
Re: [Wtr-general] Select List Question
Angrez Singh
Fri, 10 Feb 2006 11:46:10 -0800
Hi Bill,
While location the select list element WATiR codes use "select-one" or "select-multiple" for matching the type of the select list. Also the "type" attribute of select list is "readonly" as per DOM specification:
http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-94282980
So if you are assigning value to "type" attribute browser should not take the value or rather should ignore the "type" . But if it is using that value for returning the type of the select list, then WATiR code will not be able to find the control because the value that you have given for type attribute i.e. "select" doesn't matches with "select-one" or "select-multiple". So thats why if first fails but after removing the type attribute it succeeds.
So I think its IE that is not behaving according to the DOM standards. WATiR code is working fine.
Hope that helps,
Regards,
Angrez
On 2/10/06, Attebery, Bill <[EMAIL PROTECTED] > wrote:
In our in house webpage we found that some of the select lists use a attribute TYPE="SELECT" when we tried to get a handle on these SELECT_LIST objects watir failed with the cannot find object error. We did some investigating and removed this attribute from the html, and watir then found the object with no problems. So my question is, is this a bug or a known issue and if so are there any workarounds or code updates that will resolve it? If you need more info please let me know.
Here's the HTML snippet with the offending attribute in red.
<tr>
<td class="label">
<DIV CLASS="required" pii="null" name="po_order_header.order_source.label" id="po_order_header.order_source.label" title="Order Source">Order Source</DIV>
</td><td class="field"><select pii="null" id="po_order_header.order_source" TYPE="SELECT" Name="po_order_header.order_source" tabindex="15" required="true"><OPTION VALUE="" title=""></OPTION><OPTION VALUE="AuthRep" title="">Authorized Representative</OPTION><OPTION VALUE="CapAnalyst" title="">Capacity Analyst</OPTION><OPTION VALUE="City" title="">City</OPTION><OPTION VALUE="Collection" title="">Collections</OPTION></select>
</td>
</tr>
Thanks,
Bill
| The content contained in this electronic message is not intended to constitute formation of a contract binding TWTC. TWTC will be contractually bound only upon execution, by an authorized officer, of a contract including agreed terms and conditions or by express application of its tariffs. This message is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the sender of this E-Mail or by telephone. |
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
