How do I get the id or name of an element in watir? -


watir can find text on page:

<span id="i1" name="n1>some text</span>  e.text.include?("some text") 

but how can name or id of span, when know "some text"

e.text.findinpage("some text").parentelement.id (should "i1") e.text.findinpage("some text").parentelement.name (should "n1"); 

something exists in watir?

browser.span(:text => "some text").id => "i1"  browser.span(:text => "some text").name => "n1" 

tested on windows, ruby 1.8.6, watir 1.6.5, internet explorer driver.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -