On Jan 18, 2011, at 1:49 PM, Szewczyk Dratewka wrote:
> Thanks, setting the values to false gets the test working. I didn't know that
> using
> tellurium engine and css selectors had implications on using xpath. This
> makes me think
> that maybe I don't have to use xpath at all. Till now I've been trying to use
> it to solve a case
> in which there is a bunch of links like so:
>
> <div class='menu'>
> <a href="http://www.foo.com"><span>Foo</span></a>
> <a href="http://www.bar.com"><span>Bar</span></a>
> </div>
>
> and I want to get the foo link. Now if there was no <span> inside, I could
> just use
> ui.UrlLink(uid: "TheLink", clocator : [tag :"a", text : "Foo"])
>
> but the <span> makes it more difficult. Obviously I can use xpath to do this,
> but
> is there a better alternative?
Did you actually try this definition? The check for text tests against the
textContent of an element. The textContent of your <a> element is still "Foo"
even though there is also a <span> in the dom.
If this a reduced example and the actual dom has whitespace between the
elements then you might need to use the definition;
ui.UrlLink(uid: "TheLink", clocator : [tag :"a", text : "*Foo"])
in order to match the link that contains the text Foo.
Another alternative solution (if the order of the links i guaranteed) would be;
ui.Container(id:'menu', clocator:[tag:'div', 'class': 'menu') {
UrlLink(id:'foo', clocator: [position: '1'])
}
click 'menu.foo'
Which will then click on the first link in the containing element.
Regards,
Jonathan
--
You received this message because you are subscribed to the Google Groups
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tellurium-users?hl=en.