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.
