The Selenium call stack is as follows:

Selenium.prototype.getSelectedIndex = function(selectLocator) {
    /** Gets option index (option number, starting at 0) for selected option
in the specified select element.
   *
   * @param selectLocator an <a href="#locators">element locator</a>
identifying a drop-down menu
   * @return string the selected option index in the specified select
drop-down
   */
    return this.findSelectedOptionProperty(selectLocator, "index");
}

Selenium.prototype.findSelectedOptionProperty = function(locator, property)
{
    var selectedOptions = this.findSelectedOptionProperties(locator,
property);
    if (selectedOptions.length > 1) {
        Assert.fail("More than one selected option!");
    }
    return selectedOptions[0];
}

Selenium.prototype.findSelectedOptionProperties = function(locator,
property) {
   var element = this.browserbot.findElement(locator);
   if (!("options" in element)) {
        throw new SeleniumError("Specified element is not a Select (has no
options)");
    }

    var selectedOptions = [];

    for (var i = 0; i < element.options.length; i++) {
        if (element.options[i].selected)
        {
            var propVal = element.options[i][property];
            selectedOptions.push(propVal);
        }
    }
    if (selectedOptions.length == 0) Assert.fail("No option selected");
    return selectedOptions;
}

The getSelectedValue implementation is similar:

Selenium.prototype.getSelectedValue = function(selectLocator) {
    /** Gets option value (value attribute) for selected option in the
specified select element.
   *
   * @param selectLocator an <a href="#locators">element locator</a>
identifying a drop-down menu
   * @return string the selected option value in the specified select
drop-down
   */
    return this.findSelectedOptionProperty(selectLocator, "value");
}

What is the value your get back for getSelectedValue()?

If getSelectedValue() returns a correct value, then it is the
getSelectedIndex() implementation problem.
If both return wrong values, then, it is probably the runtime locator
problem. Are you using CSS selector?

Thanks,

Jian

On Fri, Sep 3, 2010 at 11:10 AM, Jade <[email protected]> wrote:

> Hi Jian,
>
> The HTMLSource is very long. Here's the part that matches this
> selector in one module: Selector(uid: "degreeSelector", clocator: [id:
> "aspect_vireo_admin_View_field_degree"])
>
> and the List in the other module:  List(uid: "degree", clocator: [tag:
> "ol", id: "aspect_vireo_admin_View_field_degree"], separator: "li") {
>                                Container(uid: "{all}", clocator: [:])
>                        }
>
> <div class="ds-form-content">
> <div class="editableWrap"><ol alt="fakefield_20" title=""
> id="aspect_vireo_admin_View_field_degree" class="fakeField fakeSelect
> ds-select-field degree editable"><li class="hidden" id="">none</li><li
> class="selected" id="Test Degree4">Test Degree4</li><li class="hidden"
> id="Test Degree3">Test Degree3</li><li class="hidden" id="Test
> Degree2">Test Degree2</li><li class="hidden" id="Business">Business</
> li><li class="hidden" id="Computer Science">Computer Science</li><li
> class="hidden" id="Test Degree1">Test Degree1</li></ol></div>
> </div>
>
> Jade
>
> On Sep 3, 9:50 am, Jian Fang <[email protected]> wrote:
> > Hi Jade,
> >
> > the getHTMLSource command only works for Tellurium new Engine. You can
> make
> > that call with the new engine as follows:
> >
> >                click "DegreeInformationForm.degree"
> >
> >                useTelluriumEngine(true)
> >                                log.info "htmlSource: " +
> > getHTMLSource("DegreeInformationClickedForm.degreeSelector")
> >                useTelluriumEngine(false)
> >
> >  TestingUtils.selectClickableOption("DegreeInformationForm.degree",
> > "DegreeInformationClickedForm.degreeSelector", this, indxToTest,
> > shouldFail)
> >
> > Hope this helps.
> >
> > Thanks,
> >
> > Jian
> >
> > On Fri, Sep 3, 2010 at 9:57 AM, Jade <[email protected]> wrote:
> > > Hi Jian,
> >
> > > I'm getting an exception when requesting the HTML source: ERROR:
> > > Cannot find UI module DegreeInformationClickedForm.degreeSelector from
> > > cache
> >
> > > Here are my lines of code (I first clicked on the list):
> >
> > >                click "DegreeInformationForm.degree"
> > >                                log.info "htmlSource: " +
> > > getHTMLSource("DegreeInformationClickedForm.degreeSelector")
> >
> > >  TestingUtils.selectClickableOption("DegreeInformationForm.degree",
> > > "DegreeInformationClickedForm.degreeSelector", this, indxToTest,
> > > shouldFail)
> >
> > > My module def:
> >
> > > public void defineModule() {
> > >                ui.Form(uid: "DegreeInformationForm", clocator: [tag:
> > > "form",
> > > method: "post", action: "${postAction}", class: "ds-interactive-div
> > > view-form", id: "aspect_vireo_admin_View_div_view-form"]) {
> > >                        InputBox(uid: "committee_member_2", clocator:
> [tag:
> > > "input", id:
> > > "aspect_vireo_admin_View_field_committee-member-2", type: "text"],
> > > respond: ["click"])
> > >                        InputBox(uid: "committee_member_1", clocator:
> [tag:
> > > "input", id:
> > > "aspect_vireo_admin_View_field_committee-member-1", type: "text"],
> > > respond: ["click"])
> >
> > >                        List(uid: "degree", clocator: [tag: "ol", id:
> > > "aspect_vireo_admin_View_field_degree"], separator: "li") {
> > >                                Container(uid: "{all}", clocator: [:])
> > >                        }
> > >                        InputBox(uid: "school", clocator: [tag: "input",
> id:
> > > "aspect_vireo_admin_View_field_school", type: "text"], respond:
> > > ["click"])
> > >                        InputBox(uid: "committee_email", clocator: [tag:
> > > "input", id:
> > > "aspect_vireo_admin_View_field_committee-email", type: "text"],
> > > respond: ["click"])
> > >                        InputBox(uid: "department", clocator: [tag:
> "input",
> > > id:
> > > "aspect_vireo_admin_View_field_department", type: "text"], respond:
> > > ["click"])
> >
> > >                        List(uid: "college", clocator: [tag: "ol", id:
> > > "aspect_vireo_admin_View_field_college"], separator: "li", respond:
> > > ["click"]) {
> > >                                Container(uid: "{all}", clocator: [:])
> > >                        }
> > >                        InputBox(uid: "committee_member_3", clocator:
> [tag:
> > > "input", id:
> > > "aspect_vireo_admin_View_field_committee-member-3", type: "text"],
> > > respond: ["click"])
> > >                        InputBox(uid: "discipline", clocator: [tag:
> "input",
> > > id:
> > > "aspect_vireo_admin_View_field_discipline", type: "text"], respond:
> > > ["click"])
> > >                        InputBox(uid: "semester", clocator: [tag:
> "input",
> > > id:
> > > "aspect_vireo_admin_View_field_semester", type: "text"], respond:
> > > ["click"])
> >
> > >                        List(uid: "degreeLevel", clocator: [tag: "ol",
> id:
> > > "aspect_vireo_admin_View_field_degreeLevel"], separator: "li",
> > > respond: ["click"]) {
> > >                                Container(uid: "{all}", clocator: [:])
> > >                        }
> > >                }
> >
> > >                //Since ajax changes the html when a list is clicked,
> this
> > > module is
> > > required to represent clickable lists once they've been clicked.
> > >                //  For more information, see:
> >
> > >http://groups.google.com/group/tellurium-users/browse_thread/thread/9.
> ..
> > >                //
> > >                ui.Form(uid: "DegreeInformationClickedForm", clocator:
> [tag:
> > > "form",
> > > method: "post", action: "${postAction}", class: "ds-interactive-div
> > > view-form", id: "aspect_vireo_admin_View_div_view-form"]) {
> >
> > >                        Selector(uid: "degreeSelector", clocator: [id:
> > > "aspect_vireo_admin_View_field_degree"])
> > >                        Selector(uid: "collegeSelector", clocator: [id:
> > > "aspect_vireo_admin_View_field_college"])
> > >                        Selector(uid: "degreeLevelSelector", clocator:
> [id:
> > > "aspect_vireo_admin_View_field_degreeLevel"])
> > >                }
> >
> > > ERROR: Cannot find UI module
> > > DegreeInformationClickedForm.degreeSelector from cache
> >
> > >
> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:
> > > 97)
> >
> > >
> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:
> > > 91)
> > >                 sun.reflect.GeneratedMethodAccessor80.invoke(Unknown
> > > Source)
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 43)
> > >                java.lang.reflect.Method.invoke(Method.java:616)
> > >                org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
> > > $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:
> > > 229)
> >
> > >
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:
> > > 52)
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > 129)
> >
> > >
> org.telluriumsource.component.connector.CustomSelenium.getBundleResponse(CustomSelenium.groovy:
> > > 257)
> > >                 sun.reflect.GeneratedMethodAccessor79.invoke(Unknown
> > > Source)
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 43)
> > >                java.lang.reflect.Method.invoke(Method.java:616)
> >
> > >  org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> > >
>  groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> >
> > > groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> > > 149)
> > >                groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> > > Source)
> >
> > >
> org.telluriumsource.component.dispatch.Dispatcher.methodMissing(Dispatcher.groovy:
> > > 60)
> > >                sun.reflect.GeneratedMethodAccessor78.invoke(Unknown
> Source)
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 43)
> > >                java.lang.reflect.Method.invoke(Method.java:616)
> >
> > >  org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> >
> > >  groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > 813)
> >
> > >  groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > 1107)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> >
> > >
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> > > 39)
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > 129)
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.passBundledCommand(BundleProcessor.groovy:
> > > 323)
> > >                 org.telluriumsource.component.bundle.BundleProcessor
> > > $passBundledCommand.callCurrent(Unknown Source)
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.process(BundleProcessor.groovy:
> > > 415)
> > >                 org.telluriumsource.component.bundle.BundleProcessor
> > > $process.callCurrent(Unknown Source)
> >
> > >
> org.telluriumsource.component.bundle.BundleProcessor.methodMissing(BundleProcessor.groovy:
> > > 428)
> > >                sun.reflect.GeneratedMethodAccessor72.invoke(Unknown
> Source)
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 43)
> > >                java.lang.reflect.Method.invoke(Method.java:616)
> >
> > >  org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> >
> > >  groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > 813)
> >
> > >  groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > 1107)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> >
> > > groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:
> > > 149)
> > >                groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown
> > > Source)
> >
> > >
> org.telluriumsource.component.custom.Extension.methodMissing(Extension.groovy:
> > > 20)
> > >                sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > 57)
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > 43)
> > >                java.lang.reflect.Method.invoke(Method.java:616)
> >
> > >  org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> > > 88)
> >
> > >  groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:
> > > 813)
> >
> > >  groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
> > > 1107)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060)
> >
> > >  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
> >
> > >
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:
> > > 39)
> >
> > >
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> > > 40)
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > 117)
> >
> > >
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > > 129)
> >
> > >
> org.telluriumsource.dsl.BaseDslContext.getHTMLSourceResponse(BaseDslContext.groovy:
> > > 1534)
> > >                org.telluriumsource.dsl.BaseDslContext
> > > $getHTMLSourceResponse.callCurrent(Unknown Source)
> >
> > >
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:
> > > 44)
> >
> > ...
> >
> > read more ยป
>
> --
> 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.

Reply via email to