If the problem is still there for the latest jar, please add it to the issue
list.

Thanks,

Jian

On Tue, Sep 7, 2010 at 9:32 AM, Jade <[email protected]> wrote:

> Hi Jian,
>
> The earlier json parse error was caused by the fact that tellurium
> isn't correctly adding the double quotes around the groovy variables
> in the action:
>
> ui.Form(uid: "DspaceLoginForm", clocator: [tag: "form", method:
> "post", action: "${VireoTestConfig.getWebApp()}/password-login",
> class: "ds-interactive-div primary", id:
> "aspect_eperson_PasswordLogin_div_login"]){
>
> [{"obj":{"uid":"DspaceLoginForm","locator":{"tag":"form","attributes":
> {"id":"aspect_eperson_PasswordLogin_div_login","action":xmlui/password-
> login,"class":"ds-interactive-div
> primary","method":"post"}},"uiType":"Form","metaData":
> {"id":"DspaceLoginForm","type":"UiObject"}},"key":"DspaceLoginForm"},
> {"obj":{"uid":"LoginPassword","locator":{"tag":"input","attributes":
>
> {"id":"aspect_eperson_PasswordLogin_field_login_password","name":"login_password","class":"ds-
> password-field","type":"password"}},"uiType":"InputBox","metaData":
>
> {"id":"LoginPassword","type":"UiObject"}},"key":"DspaceLoginForm.LoginPassword"},
> {"obj":{"uid":"LoginEmail","locator":{"tag":"input","attributes":
>
> {"id":"aspect_eperson_PasswordLogin_field_login_email","name":"login_email","class":"ds-
> text-field","type":"text"}},"uiType":"InputBox","metaData":
> {"id":"LoginEmail","type":"UiObject"}},"key":"DspaceLoginForm.LoginEmail"},
> {"obj":{"uid":"Submit","locator":
> {"direct":true,"tag":"input","attributes":
>
> {"id":"aspect_eperson_PasswordLogin_field_submit","name":"submit","value":"Sign
> in","class":"ds-button-
> field","type":"submit"}},"uiType":"SubmitButton","metaData":
> {"id":"Submit","type":"UiObject"}},"key":"DspaceLoginForm.Submit"},
> {"obj":{"uid":"Error","locator":{"tag":"span","attributes":
> {"class":"error"}},"uiType":"Span","metaData":
> {"id":"Error","type":"UiObject"}},"key":"DspaceLoginForm.Error"}]
> [[obj:[uid:DspaceLoginForm, locator:[tag:form, attributes:
> [id:aspect_eperson_PasswordLogin_div_login, action:xmlui/password-
> login, class:ds-interactive-div primary, method:post]], uiType:Form,
> metaData:[id:DspaceLoginForm, type:UiObject]], key:DspaceLoginForm],
> [obj:[uid:LoginPassword, locator:[tag:input, attributes:
> [id:aspect_eperson_PasswordLogin_field_login_password,
> name:login_password, class:ds-password-field, type:password]],
> uiType:InputBox, metaData:[id:LoginPassword, type:UiObject]],
> key:DspaceLoginForm.LoginPassword], [obj:[uid:LoginEmail, locator:
> [tag:input, attributes:
> [id:aspect_eperson_PasswordLogin_field_login_email, name:login_email,
> class:ds-text-field, type:text]], uiType:InputBox, metaData:
> [id:LoginEmail, type:UiObject]], key:DspaceLoginForm.LoginEmail], [obj:
> [uid:Submit, locator:[direct:true, tag:input, attributes:
> [id:aspect_eperson_PasswordLogin_field_submit, name:submit, value:Sign
> in, class:ds-button-field, type:submit]], uiType:SubmitButton,
> metaData:[id:Submit, type:UiObject]], key:DspaceLoginForm.Submit],
> [obj:[uid:Error, locator:[tag:span, attributes:[class:error]],
> uiType:Span, metaData:[id:Error, type:UiObject]],
> key:DspaceLoginForm.Error]]
> Error: cannot find the top object DspaceLogin
>
> Should I add this to the defects list?
>
> Jade
>
> On Sep 3, 3:28 pm, Jian Fang <[email protected]> wrote:
> > Sorry, I was wrong, "index" parameter is correct. Seems "selectedIndex"
> is
> > only used in jQuery.
> >
> > http://marcgrabanski.com/articles/jquery-select-list-values
> >
> > Then, the problem is really wired.
> >
> > I just added the getSelectedIndex() to the Engine project. Only for proof
> > purpose, if you run the following snapshot selenium server with Tellurium
> > APIs and cache enabled,
> >
> > http://maven.kungfuters.org/content/repositories/snapshots/org/seleni...
> >
> > is the problem still there?
> >
> > Thanks,
> >
> > Jian
> >
> > On Fri, Sep 3, 2010 at 3:50 PM, Jian Fang <[email protected]>
> wrote:
> > > Hi Jade,
> >
> > > If you are not using Tellurium Engine, you don't need to use cache.
> Since
> > > the getSelectedIndex is not
> > > implemented in Tellurium APIs, Tellurium Engine simply delegates the
> call
> > > to Selenium core. To prove this,
> > > set
> >
> > > useTelluriumApi(false);
> >
> > > to see if the problem is still there.
> >
> > > If it is still there, it must be the Selenium API problem. I suspect
> the
> > > "index" parameter in the method getSelectedIndex()
> > > should be "selectedIndex".
> >
> > > Will try some tests later.
> >
> > > Thanks,
> >
> > > Jian
> >
> > > On Fri, Sep 3, 2010 at 3:23 PM, Jade <[email protected]> wrote:
> >
> > >> Hi Jian,
> >
> > >> getSelectedValue works fine as does getSelectOptions and
> > >> getSelectValues.
> >
> > >> These are my test options:
> >
> > >> useTelluriumEngine(false);
> > >>                useTelluriumApi(true);
> > >>                useCache false
> > >>                useCssSelector(true);
> > >>                useTrace(true);
> >
> > >> I set useCache to false since the html changes with ajax but it
> > >> doesn't seem to fix those problems.
> >
> > >> The following method works since I changed to using getSelectedValue
> > >> instead of getSelectedIndex but it would be nice to have both options.
> >
> > >> /**
> > >>         * Test the option specified by the indx for the selection.
> > >>         *
> > >>         * @param uid
> > >>         * @param module
> > >>         * @param indx
> > >>         * @param shouldFail -- true if the indx should not be able to
> be
> > >> selected
> > >>         */
> > >>         public static void selectClickableOption(final String listUid,
> > >> final
> > >> String selectorId,
> > >>        final DslContext module, final int indx, boolean shouldFail) {
> >
> > >>                 log.info "selectClickableOption ${selectorId}"
> > >>                 // With Ajax, the module has to be clicked on so the
> uid
> > >> is found.
> > >>                module.click listUid
> >
> > >>                int len = module.getSelectOptions(selectorId).size()
> >
> > >>                log.info("selector size (" + selectorId + "): " +
> len);
> >
> > >>                if (indx > len) {
> > >>                        fail("${indx} > selector size, ${selectorId},
> size:
> > >> ${len}")
> > >>                }
> >
> > >>                 if (indx < 1) {
> > >>                        fail("indx: ${indx} must be at least 1 or
> greater,
> > >> ${selectorId},
> > >> size: ${len}")
> > >>                }
> >
> > >>                boolean successful = false;
> > >>                int maxTries = 5;
> > >>                int tries = 0;
> > >>                // Due to ajax timing issues, try more than once to
> perform
> > >> this
> > >> action.
> > >>                while (!successful && tries < maxTries) {
> > >>                        try {
> > >>                                // workaround due to tellurium bug with
> > >> indx problem returning 48
> > >> when index set to 1
> > >>                                // see
> > >>http://groups.google.com/group/tellurium-users/browse_thread/thread/9.
> ..
> > >>                                 // With Ajax, the module has to be
> clicked
> > >> on so the uid is found.
> > >>                                module.click listUid
> >
> > >>  module.pause(VireoTestConfig.getPauseTime());
> >
> > >>                                String[] values =
> > >> module.getSelectValues(selectorId)
> > >>                                for (value in values)
> > >>                                        log.info "value: ${value}"
> >
> > >>                                // With Ajax, the module has to be
> clicked
> > >> on so the uid is found.
> > >>                                module.click listUid
> >
> > >>  module.pause(VireoTestConfig.getPauseTime());
> >
> > >>                                String[] options =
> > >> module.getSelectOptions(selectorId)
> > >>                                for (option in options)
> > >>                                        log.info "option: ${option}"
> >
> > >>                                // without this, times out and field is
> no
> > >> longer selectable
> > >>                                module.click listUid
> >
> > >>  module.pause(VireoTestConfig.getPauseTime());
> > >>                                 String origValue =
> > >> module.getSelectedValue(selectorId)
> >
> > >>                                 module.click listUid
> >
> > >>  module.pause(VireoTestConfig.getPauseTime());
> > >>                                 int origIndx =
> > >> module.getSelectedIndex(selectorId);
> > >>                                 log.info "origIndx: ${origIndx}"
> > >>                                // bug?
> > >>                                // module.selectByIndex(selectorId,
> indx);
> >
> > >>                                // int selected =
> > >> module.getSelectedIndex(selectorId);
> > >>                                 module.click listUid
> > >>                                module.selectByValue selectorId,
> > >> values[indx]
> > >>                                module.click listUid
> > >>                                String selectedValue =
> > >> module.getSelectedValue(selectorId)
> >
> > >>                                //              if (shouldFail) {
> > >>                                //
> > >>  assertEquals("selectOption: selecting ${indx} for $
> > >> {selectorId} should have failed", origIndx, selected);
> > >>                                //              } else {
> > >>                                //
> > >>  assertEquals("selectOption: selecting ${indx} for $
> > >> {selectorId} should have succeeded", indx, selected);
> > >>                                 //              }
> > >>                                successful = true
> > >>                                 if (shouldFail) {
> > >>                                        assertEquals("selectOption:
> > >> selecting ${indx} for ${selectorId}
> > >> should have failed", origValue, selectedValue);
> > >>                                 } else {
> > >>                                        assertEquals("selectOption:
> > >> selecting ${indx} for ${selectorId}
> > >> should have succeeded", values[indx], selectedValue);
> > >>                                }
> > >>                        } catch (Exception e) {
> > >>                                log.error("ajax timing error: " +
> > >> e.getMessage())
> > >>                                tries++
> > >>                        } catch (Throwable t) {
> > >>                                log.error("ajax timing error: " +
> > >> t.getMessage())
> > >>                                tries++
> > >>                        }
> > >>                }
> > >>        }
> >
> > >> Jade
> >
> > >> On Sep 3, 1:24 pm, Jian Fang <[email protected]> wrote:
> > >> > 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:
> [:])
> >
> > ...
> >
> > 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