Hi Jian,

My other reply was for the InputBoxes.

For the check boxes, this is their html: <input type="checkbox"
checked="checked" value="ASSIGNED_TO" name="LIST_ASSIGNED_TO">

Since each checkbox has it's own value that I don't know, then I can't
use the getValue(); that's why I'm using the getAttribute().
isChecked() wasn't giving me reliable results when I tested about a
month ago.

Jade

On Sep 10, 8:09 am, Jian Fang <[email protected]> wrote:
> I checked the DslContext and seems the getValue() method is exposed there,
> why not
> use getValue directly? Selenium's implement of getAttribute is pretty
> complex because it
> uses an attribute locator, i.e., @Attribute, to append to the locator.
>
> Thanks,
>
> Jian
>
> On Thu, Sep 9, 2010 at 5:27 PM, Jade <[email protected]> wrote:
> > Yes, I'm using the snapshots from last night. The getText is working
> > now with the code that I posted (after I made the module definition
> > fix that I posted) but the tellurium engine had to be off. I do have
> > pauses in the code.  I also had to turn the tellurium engine off for
> > clicking on all of the checkboxes on a form or otherwise only some of
> > the checkboxes would be checked.
>
> > Here's my code for that:
>
> > public static void setCheckboxOptions(final DslContext context,
> >        final String listUid, final boolean checked) {
>
> >                int size = context.getListSizeBySelector(listUid);
>
> >                for (int i = 1; i <= size; i++) {
> >                        setCheckbox(checked, context, "${listUid}[${i}]");
> >                }
> >        }
>
> > public static void setCheckbox(final boolean on, final DslContext
> > context,
> >        final String elementUid) {
>
> >                String elementValue = (String) context
> >                                .getAttribute(elementUid, "value");
> >                boolean isChecked = context.isChecked(elementUid);
>
> >                // Since the html is sometimes returning "true" and other
> > times
> > "checked" -- this
> >                // code is more complex than it should have to be.
>
> >                log.debug("setCheckbox ${elementValue}")
>
> >                // If not set to the allow value, then click the button.
> >                if (on && !isChecked || (!on && isChecked)) {
>
> >                        context.click(elementUid);
>
> >                        context.pause(VireoTestConfig.getPauseTime());
> >                        //
> > context.waitForPageToLoad(VireoTestConfig.getMaxWait()); //
> >                        // comment
> >                        // out?
> >                        // Make sure the value is what we set it to.
>
> >                        String condition = ""
> >                        if (on) {
> >                                condition = "isChecked(\"${elementUid}\");";
> >                        } else {
> >                                condition =
> > "!isChecked(\"${elementUid}\");";
> >                        }
>
> >                        log.info("setCheckbox: " + condition);
> >                        context.waitForCondition(condition,
> > VireoTestConfig.getMaxWait());
>
> >                        context.pause(VireoTestConfig.getPauseTime());
>
> >                        // TestingUtils.waitForAjax(selenium,
> > VireoTestConfig.getMaxWait());
> >                }
> >        }
>
> > and the test calling it sets the TelluriumEngine to off:
>
> >   �...@beforeclass
> >    public static void initUi() {
> >        dlam = new DspaceLogonAdminModule();
> >        dlam.defineUi();
> >        connectSeleniumServer();
> >        useTelluriumEngine(false);
> > ...
>
> > Jade
>
> > On Sep 9, 4:08 pm, Jian Fang <[email protected]> wrote:
> > > Thanks for the details.
>
> > > The click did not work even for the latest snapshot from last night? That
> > is
> > > really wired.
>
> > > If you turn off the Engine, the getValue is called on Selenium APIs. I
> > > wonder if your problem is caused by
> > > the fact that you could not get back the correct value right away since
> > it
> > > takes some time
> > > for the value to be changed after the click event. Have you ever tried to
> > > add some delay such as
>
> > > pause(1000)
>
> > > in the command or try some waitForCondition() command?
>
> > > Thanks,
>
> > > Jian

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