Letractively / aost

Automatically exported from code.google.com/p/aost
Other
1 stars 0 forks source link

selectByValue throws exception #179

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

I've just begun to use tellurium, so please be nice with me ;-)
I 'm doing a TestNG test case with tellurium on a site that contain a
<select id="select_id"> tag with several options
I define the ui as follows :
 public void defineUi() {
       ui.UrlLink(uid: "lien", clocator: [tag: "a", href: "/path",
id: "link_id"])
       ui.Container(uid: "form", clocator: [id:"container_id"]){
           RadioButton(uid: "input0", clocator: [tag: "input", type:
"radio", value: "VALUE_1"], respond:["click"])
           RadioButton(uid: "input1", clocator: [tag: "input", type:
"radio", value: "VALUE_2"], respond:["click"])
           Selector(uid: "select2", clocator: [tag: "select", class:
"UNIQUE_CLASS_OF_SELECT"])
       }
 }
then my test is the following :
 public void fillForm(){

     waitForElementPresent("form.input0",50000)
     click "form.input0"
     println "Hello world"
     waitForElementPresent("form.input1",50000)
     click "form.input1"
     waitForElementPresent("form.select2",50000)
     def select = getUiElement("form.select2")
     println select // prints org.tellurium.object.Selector@1082277
     selectByValue("form.select2","VALUE_DESIRED") //throws
exception
 }

The last line throws an exception :
java.lang.NullPointerException: Cannot invoke method call() on null
object
       at org.codehaus.groovy.runtime.NullObject.invokeMethod
(NullObject.java:77)
       at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod
(InvokerHelper.java:743)
       at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod
(InvokerHelper.java:720)
       at org.codehaus.groovy.runtime.callsite.NullCallSite.call
(NullCallSite.java:17)
       at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:43)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call
(AbstractCallSite.java:116)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call
(AbstractCallSite.java:120)
       at org.tellurium.object.Selector.selectByValue(Selector.groovy:
18)
       at org.tellurium.object.Selector$selectByValue.call(Unknown
Source)
       at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:43)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call
(AbstractCallSite.java:116)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call
(AbstractCallSite.java:128)
       at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe
(AbstractCallSite.java:96)
       at org.tellurium.dsl.BaseDslContext.selectByValue
(BaseDslContext.groovy:226)
       at org.tellurium.dsl.BaseDslContext$selectByValue.callCurrent
(Unknown Source)
       at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
(CallSiteArray.java:47)
       at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent
(AbstractCallSite.java:142)
       at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent
(AbstractCallSite.java:154)
       at module.TestModule.fillForm(TestModule.groovy:36)
       at test.moduleTestCase.myTestSuite(Unknown Source)

Do you know what can happens ? I tried several methods, even the
direct way
(select as org.tellurium.object.Selector).selectByValue
("VALUE_DESIRED")
but this last throws a Method not found exception

Original issue reported on code.google.com by John.Jian.Fang@gmail.com on 22 Apr 2009 at 1:26

GoogleCodeExporter commented 8 years ago
It is complaining about this line

def selectByValue(String value, Closure c){

        c(locator, "value=${value}", respondToEvents)()  <-- this line
    }

Seems we have a bug here and should use

c(locator, "value=${value}", respondToEvents)

instead. 

Original comment by John.Jian.Fang@gmail.com on 22 Apr 2009 at 1:26