On Mon, Jun 6, 2011 at 6:57 PM, a b <cristina.watir.toro...@gmail.com> wrote: > > For instance: > That is a label : > <td><span class="fontmd floatleft" id="macbodypage"> > <span string="create_user" > class="macstring">Create User</span></span></td> >
This isn't valid HTML, as the error message points out. Since the parent span is unique, I would in this case start from that and locate the first span inside it: browser.span(:id => "macbodypage").span.text Calling #span without arguments assumes you want the first one. If you *really* need to locate elements using invalid attributes, you can always use an XPath: browser.span(:xpath => "//span[@class='macstring' and @string='create_user']").text or iterate through them in Ruby, using Watir::Element#attribute_value to get to fetch the invalid attribute: span = browser.spans(:class => "macstring").find { |e| e.attribute_value("string") == "create_user" } span || raise("couldn't find span") span.text The latest watir-webdriver docs can be found here: http://rubydoc.info/gems/watir-webdriver/0.2.4/frames -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com