Now that you've mentioned it - you're right the text value should actually be Foo despite the span element inside. And
ui.UrlLink(uid: "TheLink", clocator : [tag :"a", text: "Foo"]) does work. But yes, this is just a toy example - and I have to admit I didn't test the above solution with it. I tried this solution with the real html I'm working on - didn't work - probably because the * prefix was missing. Thank you for the tip. But I guess still one question remains : why doesn't the code generated be tellurium IDE work? Is it because it is generated for tellurium 0.8.0? Regards, dratewka On Tue, Jan 18, 2011 at 4:42 PM, Jonathan Share <[email protected]> wrote: > > On Jan 18, 2011, at 4:34 PM, Jonathan Share wrote: > > 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 <http://www.foo.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 > > > A third option, and possibly the best as it doesn't tie you to the > localisation of the site under test, would be to match against the href > attribute of the link of possible > > ui.UrlLink(uid: "TheLink", clocator : [tag :"a", href : "*foo.com"]) > > -- > 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]<tellurium-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/tellurium-users?hl=en. > -- 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.
