Since you have another td, shouldn't the link be tblLink[1][2]? You need to change your UI module to reflect that as well.
On Thu, May 19, 2011 at 3:13 PM, Josh Allen <[email protected]>wrote: > Haven't tried 0.8.0 yet, I'll see what happens when I use that. > > Output from the diagnose call is as follows: > > ------------------------------------------------------- > > Matching count: 0 > > > Parents: > > --- Parent 1 --- > > <td>Google</td> > > HTML Source: > > <head> > </head><body><table id="tblLink"> > <tbody><tr> > <td>Google</td> > <td><a href="http://www.google.com/">Link</a></td> > </tr><tr> > </tr></tbody></table> > </body> > > ------------------------------------------------------- > > Looks like the intended target is Parent 1? > > - Josh > > On May 19, 11:13 am, Jian Fang <[email protected]> wrote: > > Have you tried Tellurium 0.8.0 snapshot? > > > > Seems the jquery selector cannot find the UI element, would it include > > multiple matches? > > > > Try to run > > > > diagnose("tblLink[1][1]") > > > > and post the output. > > > > Thanks, > > > > Jian > > > > On Thu, May 19, 2011 at 12:10 PM, Josh Allen <[email protected] > >wrote: > > > > > > > > > > > > > > > > > I'm using Tellurium v0.7.0. Also if this helps, here's related code > > > that causes the exception when useTelluriumEngine(true) is left out: > > > > > HTML: > > > <table id="tblLink"> > > > <tr> > > > <td>Google</td> > > > <td><a href="http://www.google.com/">Link</a></td> > > > <tr> > > > </table> > > > > > UIModule: > > > ui.Table(uid: "tblLink", clocator: [tag: "td", id: "tblLink"]) { > > > TextBox(uid: "{row: all, column: 1}", clocator: [tag: "td"]) > > > UrlLink(uid: "{row: all, column: 2}", clocator: [tag: "a", text: > > > "Link"]) > > > } > > > > > The function that causes the exception: > > > public void testTextBox() { > > > def targetTextBox = "tblLink[1][1]" > > > println getText(targetTextBox) > > > } > > > > > ...and finally, the exception: > > > com.thoughtworks.selenium.SeleniumException: ERROR: Element > > > uimcal={"rid":"tblLink[1][1]","locator":"jquery=#tblLink > tbody > > > > tr:has(td):eq(0) > td:eq(0) td"} not found > > > > > Thanks again, > > > - Josh > > > > > On May 19, 10:42 am, Jian Fang <[email protected]> wrote: > > > > Which version of Tellurium are you using? > > > > > > useTelluriumEngine(true) > > > > > > means that you are using the new Tellurium engine. I will try that > with > > > the > > > > test case tonight. > > > > > > Thanks, > > > > > > Jian > > > > > > On Thu, May 19, 2011 at 11:19 AM, Josh Allen < > [email protected] > > > >wrote: > > > > > > > Hi Jian, > > > > > > > Thanks for your quick response. Your code does indeed work, and I > may > > > > > have determined what makes mine fail. Previously, my initUi > function > > > > > consisted of the following: > > > > > > > @BeforeClass > > > > > public static void initUi() { > > > > > ulm = new UrlLinkModule(); > > > > > ulm.defineUi(); > > > > > > > connectSeleniumServer(); > > > > > useTelluriumEngine(true); > > > > > useTrace(true); > > > > > } > > > > > > > After trying several things to reconcile our code, I commented out > > > > > useTelluriumEngine(true), and the scenario I previously described > > > > > works: the link's href is non-null, and clicking the link works. > Any > > > > > ideas why this may be? > > > > > > > I noticed in the documentation that this function enables the use > of > > > > > caching and the tellurium API, so I'm guessing this is something > that > > > > > I wouldn't want to comment out. Sure enough, other scenarios now > do > > > > > not work: an exception now occurs when I try to identify a textbox > > > > > within a table. > > > > > > > Thanks, > > > > > - Josh > > > > > > > On May 18, 5:10 pm, Jian Fang <[email protected]> wrote: > > > > > > Here is the output for the test case: > > > > > > > > TE: Name: isElementPresent, start: 1305756372015, duration: 62ms > > > > > > TE: Name: isElementPresent, start: 1305756372015, duration: 62ms > > > > > > TE: Name: getText, start: 1305756372081, duration: 51ms > > > > > > TE: Name: getText, start: 1305756372081, duration: 51ms > > > > > > text: Link > > > > > > html: <a>Link</a> > > > > > > > > TE: Name: getAttribute, start: 1305756372153, duration: 52ms > > > > > > TE: Name: getAttribute, start: 1305756372153, duration: 52ms > > > > > > href:http://www.google.com/ > > > > > > TE: Name: click, start: 1305756372226, duration: 53ms > > > > > > TE: Name: click, start: 1305756372226, duration: 53ms > > > > > > TE: Name: waitForPageToLoad, start: 1305756372284, duration: > 1822ms > > > > > > TE: Name: waitForPageToLoad, start: 1305756372284, duration: > 1822ms > > > > > > > > On Wed, May 18, 2011 at 6:10 PM, Jian Fang < > [email protected] > > > > > > > wrote: > > > > > > > I tried the same code you used and just replace your url with > > > Google's > > > > > but > > > > > > > cannot reproduce your problem. > > > > > > > > > Here is the code: > > > > > > > > > --- UI Module ----- > > > > > > > package org.telluriumsource.module > > > > > > > > > import org.telluriumsource.dsl.DslContext > > > > > > > > > class UrlLinkModule extends DslContext { > > > > > > > public void defineUi() { > > > > > > > > > ui.Table(uid: "tblLink", clocator: [tag: "td", id: > > > "tblLink"]) > > > > > { > > > > > > > UrlLink(uid: "{row: 1, column: 1}", clocator: [tag: > > > "a", > > > > > text: > > > > > > > "Link"]) > > > > > > > } > > > > > > > } > > > > > > > > > public void testLink() { > > > > > > > > > def targetLink = "tblLink[1][1]" > > > > > > > println "text: " + getText(targetLink) > > > > > > > println "html: " + toHTML(targetLink) > > > > > > > println "href: " + getLink(targetLink) > > > > > > > click targetLink > > > > > > > waitForPageToLoad 30000 > > > > > > > } > > > > > > > } > > > > > > > > > ---- Test Case ---- > > > > > > > > > package org.telluriumsource.ft; > > > > > > > > > import org.junit.Before; > > > > > > > import org.junit.BeforeClass; > > > > > > > import org.junit.Test; > > > > > > > import org.telluriumsource.module.UrlLinkModule; > > > > > > > import > org.telluriumsource.test.java.TelluriumMockJUnitTestCase; > > > > > > > > > public class UrlLinkTestCase extends TelluriumMockJUnitTestCase > { > > > > > > > private static UrlLinkModule ulm; > > > > > > > > > @BeforeClass > > > > > > > public static void initUi() { > > > > > > > registerHtml("UrlLink"); > > > > > > > > > ulm = new UrlLinkModule(); > > > > > > > ulm.defineUi(); > > > > > > > useTrace(true); > > > > > > > } > > > > > > > > > @Before > > > > > > > public void connectToLocal() { > > > > > > > connect("UrlLink"); > > > > > > > } > > > > > > > > > @Test > > > > > > > public void validate(){ > > > > > > > ulm.validate("tblLink"); > > > > > > > } > > > > > > > > > @Test > > > > > > > public void testClickUrl(){ > > > > > > > ulm.testLink(); > > > > > > > } > > > > > > > > > } > > > > > > > > > You can check our tellurium trunk core project and look at the > > > above > > > > > > > example there. > > > > > > > > > Thanks, > > > > > > > > > Jian > > > > > > > > > On Wed, May 18, 2011 at 3:21 PM, Josh Allen < > > > [email protected] > > > > > >wrote: > > > > > > > > >> I'm encountering an issue involving links within tables that I > > > just > > > > > > >> can't figure out, even after reading oodles of documentation > and > > > > > > >> perusing discussion boards... > > > > > > > > >> Suppose I have a link inside a table. When looking for such a > > > link in > > > > > > >> a test, Tellurium seems to identify the correct object, but > > > clicking > > > > > > >> the link does nothing. Here's a simplified example: > > > > > > > > >> Given HTML... > > > > > > > > >> <table id="tblLink"> > > > > > > >> <tr> > > > > > > >> <td><a href="http://www.link.com/ > ">Link</a></td> > > > > > > >> <tr> > > > > > > >> </table> > > > > > > > > >> ...I define the following UI module: > > > > > > > > >> ui.Table(uid: "tblLink", clocator: [tag: "td", id: "tblLink"]) > { > > > > > > >> UrlLink(uid: "{row: 1, column: 1}", clocator: [tag: > "a", > > > text: > > > > > > >> "Link"]) > > > > > > >> } > > > > > > > > >> Given the above setup, I then execute the following code... > > > > > > > > >> def targetLink = "tblLink[1][1]" > > > > > > >> println "text: " + getText(targetLink) > > > > > > >> println "html: " + toHTML(targetLink) > > > > > > >> println "href: " + getLink(targetLink) > > > > > > >> click targetLink > > > > > > >> waitForPageToLoad 30000 > > > > > > > > >> ...which results in the output... > > > > > > >> text: Link > > > > > > >> html: <a>Link</a> > > > > > > >> href: null > > > > > > > > >> ...and clicking on the link times out after the given 30 > seconds. > > > > > > > > >> So given that the text is correct, I'm inclined to think > Tellurium > > > > > > >> locates the correct UI object, but is for some reason unable > to > > > detect > > > > > > >> the link's target. I've tried the same link everywhere else > -- > > > within > > > > > > >> a list, a container, or on its own -- and everything works as > > > > > > >> expected, so I'm guessing I'm missing something on this table > > > > > > >> definition. > > > > > > > > >> Any help for this Tellurium novice would be greatly > appreciated. > > > > > > >> Thanks! > > > > > > > > >> -- > > > > > > >> 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. > > > > > > > -- > > > > > 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. > > > > > -- > > > 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. > > -- > 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. > > -- 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.
