Is there a grid similar to the one for Watir that tells you what methods can be used to identify what elements?
I've looked at the rdoc, and maybe I'm missing something that's obvious to others, but when I look at an HTML_element such as say a Span, how can I tell which attributes I am allowed to use to identify the element? With Watir, I can look at this Wiki page: http://wiki.openqa.org/display/WTR/HTML+Elements+Supported+by+Watir But it seems like Watir-Webdriver has a slightly different list of allowed elements and also 'hows' that are supported when it comes time to identify an element. On Jun 6, 10:38 am, Jari Bakken <[email protected]> wrote: > On Mon, Jun 6, 2011 at 6:57 PM, a b <[email protected]> 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. [email protected] http://groups.google.com/group/watir-general [email protected]
