If the class keeps changing during the test, you better to exclude it or use
a partial match.
You don't really need all attributes for a UI object. Try to locate the UI
element using as few attributes as possible.

For the following html source,

<table class="main-table">
     <tbody>
          <tr>
              <td class="selected-tab" onmouseout="somethin"
onmouseover="somethin" onclick="goto_page1">
                    <div class="tab-first-div">Tab1</div>
             </td>
              <td class="unselected-tab" onmouseover="somethin"
onmouseout="somethin" onclick="goto_page2">
                     <div class="tab-second-uncoloured"
id='tabSearch'>Tab2</div>
              </td>
          </tr>
       </tbody>
</table>

Please try the following UI module,

ui.Table(uid: "main-table", clocator: [class: "main-table"]){
  Container(uid: "all", clocator: [tag: "td", class: "$selected-tab"],
respond: [mouseOut, mouseOver, click]){
    TextBox(uid: "div", clocator: [tag: "div", class: "^tab-"]
  }
}

Then you can use

click "main-table[1][2]"

to act on the "td" tag and use

getText("main-table[1][2].div")

to get back the text for tab2.

Please let us know if this works for you.

Thanks,

Jian


On Tue, Sep 1, 2009 at 1:43 AM, prasanna bhat <[email protected]>wrote:

> Hi Vivek,
>
> I'm very glad to tell  you that i'm making good progress with the pointers
> you guys  are providing me but the problem still persists.
>
> As you had mentioned, there was *"X"* element at the end and i *resolved*it 
> by setting appropriate value for those attributes.
> But the problem is still not resolved.
>
> sorry i cannot share the actual code with you, but I will try my best to
> brief it below,
>
> <table class="main-table">
>      <tbody>
>           <tr>
>               <td class="selected-tab" onmouseout="somethin"
> onmouseover="somethin" onclick="goto_page1">
>                     <div class="tab-first-div">Tab1</div>
>              </td>
>               <td class="unselected-tab" onmouseover="somethin"
> onmouseout="somethin" onclick="goto_page2">
>                      <div class="*tab-second-uncoloured*"
> id='tabSearch'>Tab2</div>
>               </td>
>           </tr>
>        </tbody>
> </table>
>
> so this is the piece of code i have to deal with.
>
> And my task is to record the UI for Tab2 and perform a click operation
> on it (Tab2)  and the problem i'm facing is, when i perform a mouseover on
> Tab2, the class of Tab2 is changed by JavaScript  to tab-second-uncoloured.
>
> ( and i think this is the problem y the TrUMP is not able to map the
> object.)
>
> The changed Tab2 is as below
>
>                <td class="unselected-tab" onmouseover="somethin"
> onmouseout="somethin" onclick='gotopage2'>
>                      <div class="*tab-second-coloured*"
> id='tabSearch'>Tab2</div>
>               </td>
>
>  i) My actual task is to perform a click on the Tab2.
>  ( since the class of Tab2 is changing on the mouseover, i decided to
> perform mouseover first and then click on the Tab2 )
> The groovy code i have used is as below
>
> *Module 1:*
> defineUI(){
>
>   *ui*.Container(*uid*: "tabContainer", *clocator*: [tag: "*td*", class:
> "unselected-tab"] ){
>
>   *Div*(*uid*: "search", *clocator*: [tag: "*div*",text: "Tab2", class:
> "tab-second-uncoloured", id: "tabSearch"] )
>
>   *Div*(*uid*: "onMouseOverSearch", *clocator*: [tag: "*div*",text="Tab2",
> class: "tab-second-coloured", id: "tabSearch"]
>
> }
>
> public void clickTab2(){
>
> mouseOver "tabContainer.search"
>
> click "tabContainer.onMouseOverSearch"
>
> waitForPageToLoad 30000
>
> }
>
> when i call clickTab2 from a Junit Testcase, it gives me an error:
> //descendant-self/unselected-tab/tab-second-uncolour...@='tabSearch] not
> Found. (Its not the exact error but i hope i have conveyed you the meaning )
>  *
> *
> ii) However my code in groovy works fine when i just perform a mouseOver
> operation on Tab2
>    ( the Div tag below is the one i  resolved by removing the "X" mark
> during customize (as per ur sugesstion) by pointing it to   appropriate
> class i.e class: tab-second-uncoloured )
>
> *Module 2:*
>
>   defineUI(){
>          * Div *(*uid*: "search", *clocator*: [tag: "*div*", class:
> "tab-second-uncoloured", id: "tabSearch"], respond:
> ["mouseOver","mouseOut"])
>   }
>
>
> public void clickTab2(){
>         mouseOver  "search"
> }
>
> when i call clickTab2 from Junit, it performs a mouseOver operation on
> Tab2.
> *
>
> *
> Assumptions and Conclusions:
>
> The way i have mapped the objects in *Module 1* may be wrong, i.e having
> two Div elements but pointing to the same object.
> But I tried using the table format, i.e.
> ui.Table() {
>   td...
>   Div ....
> }
> but i'm not able to figure out how to write the UIModule manually.
>
> and also the JavaScript *onclick *is defined  for <td> and not on <div>, (
> please see the HTML code i have given above), so performing a click
> operation on *<Div>* or ui.Div does not actually trigger a click operation
> as per my assumption. And also since *onclick* is defined for *<td
> class="unselected-tab">,* i think click from DSL has to be called on td,
> but the problem is *td* is not a UIObject and click cannot be called on td
> element.
>
> *
> *
> **
> I will be glad to provide you with more information if this is not clear
> and please throw light on how can i *map UI Objects or write UI Modules
> manually*.
>
> Once again i'm very glad that you people are providing enormous support and
> helping  me to progress. Thanks to all the people who are sincerely involved
> in this project.
>
> Thanks
> Prasanna
>
>
>
>
>
>
>
>
>
>
> On Mon, Aug 31, 2009 at 8:08 PM, Vivek <[email protected]> wrote:
>
>>
>> TrUMP is saying that it cannot identify the element in the DOM and so
>> when you are running the test, Tellurium cannot find the Div element.
>> I would suggest to record the Div element and after clicking the
>> Generate button. Click Customize at the top and see if that DIV
>> element has "x" at the end. I suspect it does. So try to customize
>> using the attributes shown in the right pane and see if it will remove
>> "x".
>>
>> If its possible can you provide us with the HTML...
>>
>> Thanks,
>> Vivek
>>
>> On Aug 31, 7:59 am, prasanna bhat <[email protected]> wrote:
>> > Hi Jian,
>> >
>> > I'm able to record the UI objects using the TrUMP plug-in which i
>> downloaded
>> > from the URL below. The UI Object is actually of type <div> and the
>> action
>> > performed is click i.e its not a default button but a <div> element
>> > performing the same action as button. I copied the generated UI Module
>> from
>> > TrUMP to a groovy file and tried performing click operation, an error
>> > occured.
>> >
>> > This is the snap shot.
>> >
>> > defineUi() {
>> >
>> > ui.Div(uid: "search", clocator: [tag: "div",text: " Search ", *class*:
>> > "tab-unselected-on-color
>> > tab-unselected l", id: "tabSearch"])
>> >
>> > }
>> >
>> > public void clickSearch(){
>> >
>> > click "search"
>> >
>> > }
>> >
>> > this is the error i got in Eclipse Ganymede after running a simple Junit
>> > Test:
>> >
>> > Error: org.tellurium.exception.UiObjectNotFoundException: Cannot find UI
>> > Object search
>> >  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>> >  at
>> >
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> >  at
>> >
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> >  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> >  at
>> >
>> org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
>> >  at
>> >
>> org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:192)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:200)
>> >  at
>> >
>> org.tellurium.dsl.BaseDslContext.walkToWithException(BaseDslContext.groovy:214)
>> >  at
>> org.tellurium.dsl.BaseDslContext$walkToWithException.callCurrent(Unknown
>> > Source)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:155)
>> >  at org.tellurium.dsl.BaseDslContext.click(BaseDslContext.groovy:219)
>> >  at org.tellurium.dsl.BaseDslContext$click.callCurrent(Unknown Source)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
>> >  at
>> >
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
>> >  at
>> com.tellurium.mytest.DESFlowSearch.clickSearch(DESFlowSearch.groovy:19)
>> >  at
>> >
>> com.tellurium.mytest.DESFlowSearchTestCase.testClick(DESFlowSearchTestCase.java:25)
>> >  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >  at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >  at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >  at java.lang.reflect.Method.invoke(Method.java:597)
>> >  at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
>> >  at
>> >
>> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
>> >  at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
>> >  at
>> >
>> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
>> >  at
>> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
>> >  at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
>> >  at
>> >
>> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
>> >  at
>> >
>> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
>> >  at
>> >
>> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
>> >  at
>> >
>> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
>> >  at
>> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
>> >  at
>> >
>> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>> >  at
>> >
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
>> >  at
>> >
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>> >  at
>> >
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>> >  at
>> >
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>> >  at
>> >
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>> >  at
>> >
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>> >
>> > and The Log in TrUMP 0.2.0 plug-in shows a warning as below:
>> >
>> >    - [warn] The XPath for Node div0
>> >
>>  //descendant-or-self::div[normalize-space(text())=normalize-space("Search")
>> >    and @class="tab-unselected-on-color tab-unselected l" and
>> @id="tabSearch"]
>> >    returned 0 nodes, failed validation
>> >    - [warn] The XPath for Node div0
>> >
>>  //descendant-or-self::div[normalize-space(text())=normalize-space("Search")
>> >    and @class="tab-unselected-on-color tab-unselected l" and
>> @id="tabSearch"]
>> >    returned 0 nodes, failed validation
>> >
>> > please help me out with this, i will be expecting your reply soon.
>> >
>> > Thanks,
>> >
>> > Prasanna
>> >
>> > On Sat, Aug 29, 2009 at 12:52 AM, Jian Fang <[email protected]
>> >wrote:
>> >
>> > > Thanks to Vivek for the quick fix. Please download the latest snapshot
>> from
>> >
>> > >http://kungfuters.org/nexus/content/repositories/snapshots/tellurium/.<http://kungfuters.org/nexus/content/repositories/snapshots/tellurium/>
>> ..
>> >
>> > > and install it. You should be able to record now.
>> >
>> > > The frame/iframe support still needs more work.
>> >
>> > > Thanks,
>> >
>> > > Jian
>> >
>> > > On Fri, Aug 28, 2009 at 9:24 AM, Mahendra Kariya <
>> [email protected]
>> > > > wrote:
>> >
>> > >> Which version of Firefox are you using? There are a few problems with
>> the
>> > >> latest version and we are working on it.
>> >
>> > >> Regards,
>> > >> Mahendra Kariya
>> > >>http://www.mahendrakariya.blogspot.com
>> >
>> > >> On Fri, Aug 28, 2009 at 12:52 PM, prasanna bhat <
>> [email protected]
>>  > >> > wrote:
>> >
>> > >>> Hi,
>> >
>> > >>>    I'm a novice tester. I have started using tellurium testing
>> > >>> framework recently and i would like to thank all of you who are
>> > >>> involved in this project for providing such vast amount of resources
>> > >>> and information at projects website.
>> > >>> I'm able to execute sample examples (using Eclipse and Junit) which
>> > >>> were posted in the tellurium home page and also i tried few examples
>> > >>> on my own.
>> >
>> > >>> The problem i'm facing is this:
>> > >>>   I'm able to record UI on few web pages, but i'm not able to record
>> > >>> Google home Page (http://www.google.co.in) and also i need to test
>> my
>> > >>> web application, whose UI is also not getting recorded with TrUMP.
>> >
>> > >>>  the log generated by TrUMP looks like this
>> >
>> > >>>    * [error] uiModelArray is not defined, cannot generate source!
>> > >>>    * [warn] The root node in the Tree is null
>> >
>> > >>>  please help me with this.
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to