Here is the code that threw the error:
TelluriumApi.prototype.isChecked = function(locator) {
var element = this.cacheAwareLocate(locator);
if (element.checked == null) {
throw new SeleniumError("Element is not a toggle-button.");
}
return element.checked;
};
I assume you are using Tellurium new Engine. Have you tried to use Selenium
core by calling
useTelluriumEngine(false)
at the beginning of your test code and see what happens?
Thanks,
Jian
On Fri, Jul 23, 2010 at 12:30 PM, Jade <[email protected]> wrote:
> Hi Jian,
>
> I looked at the example and I added a few more diagnostic tests. I'm
> still stumped as to why this line of code
>
> boolean checked = upm
>
>
> .isChecked("Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[1]");
>
> produces this error: com.thoughtworks.selenium.SeleniumException:
> ERROR: Element is not a toggle-button.
>
> Here are the diagnose results in case this sheds light on anything:
>
> Diagnosis Result for
> Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[1]
>
> -------------------------------------------------------
>
> Matching count: 1
>
> Match Elements:
>
> --- Element 1 -->
>
> <input name="LIST_ASSIGNED_TO" value="ASSIGNED_TO" checked="checked"
> type="checkbox">
>
>
> Parents:
>
> --- Parent 1 ---
>
> <li class="ds-form-item odd">
> <div class="ds-form-content">
> <fieldset id="N100E3" class="ds-checkbox-field settings_onclick">
> <label>
> <input name="LIST_ASSIGNED_TO" value="ASSIGNED_TO" checked="checked"
> type="checkbox">Assigned To</label>
> </fieldset>
> </div>
> </li>
>
>
> Closest:
>
>
> Closest:
>
> --- closest element 1 ---
>
> <input name="LIST_ASSIGNED_TO" value="ASSIGNED_TO" checked="checked"
> type="checkbox">
>
> It looks like it's finding the checkbox but I can't use the checkbox
> in any methods such as getValue() or isChecked()
>
> stack trace:
>
> com.thoughtworks.selenium.SeleniumException: ERROR: Element is not a
> toggle-button.
> at
>
> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:
> 97)
> at
>
> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:
> 91)
> at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
> $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:
> 229)
> at
>
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:
> 52)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
> at
>
> org.telluriumsource.component.connector.CustomSelenium.getBundleResponse(CustomSelenium.groovy:
> 257)
> at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> at
> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> 149)
> at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown Source)
> at
>
> org.telluriumsource.component.dispatch.Dispatcher.methodMissing(Dispatcher.groovy:
> 56)
> at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> 813)
> at
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> 1107)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> at
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> 39)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
> at
>
> org.telluriumsource.component.bundle.BundleProcessor.passBundledCommand(BundleProcessor.groovy:
> 322)
> at org.telluriumsource.component.bundle.BundleProcessor
> $passBundledCommand.callCurrent(Unknown Source)
> at
>
> org.telluriumsource.component.bundle.BundleProcessor.process(BundleProcessor.groovy:
> 414)
> at org.telluriumsource.component.bundle.BundleProcessor
> $process.callCurrent(Unknown Source)
> at
>
> org.telluriumsource.component.bundle.BundleProcessor.methodMissing(BundleProcessor.groovy:
> 427)
> at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> 813)
> at
> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> 1107)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> at
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> 39)
> at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
> at
> org.telluriumsource.component.data.Accessor.isChecked(Accessor.groovy:
> 52)
> at
> org.telluriumsource.component.data.Accessor$isChecked.call(Unknown
> Source)
> at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 129)
> at org.telluriumsource.dsl.BaseDslContext
> $_isChecked_closure36.doCall(BaseDslContext.groovy:497)
> 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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 88)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> at
>
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:
> 272)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> at
>
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> 39)
> at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 125)
> at org.telluriumsource.ui.object.CheckBox.isChecked(CheckBox.groovy:
> 48)
> at org.telluriumsource.ui.object.CheckBox$isChecked.call(Unknown
> Source)
> at
>
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> 40)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 117)
> at
>
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> 125)
> at
> org.telluriumsource.dsl.BaseDslContext.isChecked(BaseDslContext.groovy:
> 495)
> at
>
> test.admin.SettingsJUnitTestCase.testSetUserPreferences(SettingsJUnitTestCase.java:
> 78)
> 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.runners.model.FrameworkMethod
> $1.runReflectiveCall(FrameworkMethod.java:44)
> at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
> 15)
> at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
> 41)
> at
>
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
> 20)
> at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
> 76)
> at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
> 50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
> 28)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
> 31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:
> 46)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
> 38)
> at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
> 467)
> at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
> 683)
> at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
> 390)
> at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
> 197)
>
> Is there a piece of code in tellurium that I should put a breakpoint
> on to check a value?
>
> Thanks,
>
> Jade
>
>
> On Jul 23, 9:05 am, Jian Fang <[email protected]> wrote:
> > The ui-examples reference project includes a List example, which you can
> > find from 0.7.0 release tar ball, or from here:
> >
> > http://code.google.com/p/aost/source/browse/trunk/reference-projects/...
> >
> > We will look at your problem and see what was wrong there. From the error
> > message itself,
> > seems the getInputValue(element) function did not return a String, thus,
> it
> > did not have the trim()
> > method on it. We need to create a mock test case to locate the root
> cause.
> >
> > Thanks,
> >
> > Jian
> >
> > On Fri, Jul 23, 2010 at 9:48 AM, Jade <[email protected]> wrote:
> > > Hi Jian,
> >
> > > The issue is that this jquery script timed out even though I'm only
> > > accessing one item so I must either have an error in the script or
> > > something wrong with my environment:
> >
> > > runScript
> > > ("teJQuery('input:checkbox[name=LIST_COLUMN_ASSIGNED_TO]').click();");
> >
> > > I also tried to iterate through the items in the list to individually
> > > click them but I'm having a problem with the syntax for accessing each
> > > item. I've read the Reference documentation many times. If someone on
> > > the team has a chance to include junit or testng tests or tests
> > > written in groovy that access the items defined in the defineUI()
> > > method with each snippet of the module code in the documentation, that
> > > would help newbies a lot with the syntax!
> >
> > > I'm having problems accessing each list element:
> >
> > > public void doSetAllCheckboxes(boolean checked) {
> >
> > > String filterList =
> > > "Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList"
> > > int len = getListSize(filterList)
> >
> > > for (int i = 1; i <= len; ++i) {
> > > if (checked) {
> > > def value =
> > >
> getValue("Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[2]")
> > > //
> > > for debugging
> > > //def item = filterList[i];
> >
> > > // error on next line: SeleniumException: ERROR: Element is not a
> > > toggle-button
> > > if (!
> >
> > >
> isChecked("Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[$
> > > {i}]")) {
> > > click
> > > "Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[$
> > > {i}]"
> > > pause 300 // for ajax
> > > String script =
> >
> > >
> "isChecked(\"Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[$
> > > {i}]\");";
> > > waitForCondition script, 30000
> > > }
> > > }
> > > }
> > > // This times out
> > > //runScript
> > > ("teJQuery('input:checkbox[name=LIST_COLUMN_ASSIGNED_TO]').click();");
> > > }
> >
> > > This line:
> >
> > > def value =
> >
> > >
> getValue("Formprefs.ListTabOptions.FilterOptionsListFieldset.FilterOptionsList[2]")
> >
> > > gives me this stack trace:
> >
> > > com.thoughtworks.selenium.SeleniumException: ERROR: Command execution
> > > failure. Please search the Tellurium User Group at
> > >http://groups.google.com/group/tellurium-usersfor error details from
> > > the log window. The error message is: getInputValue(element).trim is
> > > not a function
> > > at
> >
> > >
> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:
> > > 97)
> > > at
> >
> > >
> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:
> > > 91)
> > > at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
> > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
> > > $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:
> > > 229)
> > > at
> >
> > >
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:
> > > 52)
> > > at
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > 129)
> > > at
> >
> > >
> org.telluriumsource.component.connector.CustomSelenium.getBundleResponse(CustomSelenium.groovy:
> > > 257)
> > > at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
> > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > > org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> > > at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> > > at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
> > > at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> > > at
> > > groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> > > 149)
> > > at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> Source)
> > > at
> >
> > >
> org.telluriumsource.component.dispatch.Dispatcher.methodMissing(Dispatcher.groovy:
> > > 56)
> > > at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
> > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > > org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> > > at
> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > 813)
> > > at
> > > groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > 1107)
> > > at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> > > at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> > > at
> >
> > >
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> > > 39)
> > > at
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > 129)
> > > at
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.passBundledCommand(BundleProcessor.groovy:
> > > 322)
> > > at org.telluriumsource.component.bundle.BundleProcessor
> > > $passBundledCommand.callCurrent(Unknown Source)
> > > at
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.process(BundleProcessor.groovy:
> > > 414)
> > > at org.telluriumsource.component.bundle.BundleProcessor
> > > $process.callCurrent(Unknown Source)
> > > at
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.methodMissing(BundleProcessor.groovy:
> > > 427)
> > > at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
> > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > > org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> > > at
> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > 813)
> > > at
> > > groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > 1107)
> > > at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> > > at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> > > at
>
> --
> 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.