Finally, I got it to work by adding "javascript: "
before the actual script like this,
doc_ele.getHtmlElementsByAttribute('input', 'id',
'form1:table1:actionsTop:viewDetailAction').each{
it.setAttributeValue("onclick","javascript:
setTimeout('initAllRows(); disableActions()', 0)")
}
After doing this, disableActions() is executed
properly.
seems webtest needs "javascript: " be put in front of
the javascript function.
thanks a lot!!
Chang
--- Chang Su <[EMAIL PROTECTED]> wrote:
> Marc,
>
> I got it to display xml by using,
>
> def windows = step.context.webClient.webWindows
> def outFile=new File ('xml_output')
> outFile.write('')
> windows.each
> {
> outFile.append(it.enclosedPage.asXml())
> outFile.append("\n-------\n")
> }
>
>
> the saved xml output shows the button is still
> disabled.
> <input value="View Detail" type="submit"
> disabled="disabled" ....
>
>
> The enabling of this button "should" be triggered by
> setting a check box which runs embedded javascript
> disableActions() to enable the button.
>
> <input value="0" type="checkbox" checked="checked"
> onclick="setTimeout('initAllRows();
> disableActions()', 0)"
> name="form1:table1:rowGroup1:0:col0:select"
> id="form1:table1:rowGroup1:0:col0:select"/>
>
> does this mean
> 1) webtest does not know how to run embedded java
> script disableActions() in above xml
>
> or
>
> 2) the button has become enabled however the new
> response was not saved and webtest still works on
> the
> previous response?
>
> (I am copying on [EMAIL PROTECTED] as I saw he
> mentioned something might be related in archived
> email, javascript..)
>
> thanks,
>
> Chang
>
> --- Marc Guillemot <[EMAIL PROTECTED]> wrote:
>
> > Hi Chang,
> >
> > you can dump the current state of the current page
> > at any time with a
> > small script step like the groovy one in previous
> > mail at any time. This
> > allows you to "see" the current status of the
> page.
> > There was a
> > discussion on this mailing list about extending
> the
> > save mechanism (I
> > don't remember if a issue has been opened for
> that)
> > to save the current
> > state of the page each time it changes but nothing
> > has been implemented
> > since this time.
> >
> > I recommend you to dump the current page once
> you've
> > enabled the button
> > to see if it is really enabled as expected. This
> > should show you to if
> > the page has been correctly parsed (ie if the
> > onclick is really attached
> > to the button).
> >
> > Marc.
> >
> > Chang Su wrote:
> > > Hi,
> > >
> > > I have difficulty to click on one button and
> > launch
> > > new jsp page. this button has following html
> > > attributes,
> > >
> > >
> > > <input
> > id="form1:table1:actionsTop:viewDetailAction"
> > > name="form1:table1:actionsTop:viewDetailAction"
> > > class="Btn2Dis" onblur="return this.myonblur();"
> > > onfocus="return this.myonfocus();"
> > onmouseout="return
> > > this.myonmouseout();" onmouseover="return
> > > this.myonmouseover();" disabled="disabled"
> > onclick="if
> > > (confirmDeleteSelectedRows() == false) return
> > false"
> > > type="submit" value="View Detail" /><script
> > >
> >
>
type="text/javascript">sjwuic_assign_button('form1:table1:actionsTop:viewDetailAction',
> > > defaultButtonStrings, true, false,
> true);</script>
> > >
> > > This html was saved at the begining of the tests
> > so it
> > > shows this button "disabled", after a couple of
> > steps
> > > (setCheckbox), it should become "enabled" (but
> > > sowmehow I tried to do "save" in <setCheckbox>
> > > however it does not work)
> > >
> > > Anyway, I tried
> > >
> > > <clickElement
> > >
> >
>
xpath="//[EMAIL PROTECTED]'form1:table1:actionsTop:viewDetailAction']"/>
> > >
> > > <verifytitle
> > > text="CPU and Memory"/>
> > >
> > > It complains about the page title (expects the
> > > previous page title somehow)
> > >
> > > so my questions are:
> > > 1) how do I know whether a button is enabled or
> > > disabled? (this button is supposed to be enabled
> > at
> > > this point, however how do I verify that?)
> > >
> > > 2) I got the xpath of the button from XPE tools.
> > why
> > > is it not launching the new page? I tried
> > > <clickButton>, it gave me the same thing.
> > >
> > > thanks,
> > >
> > > Chang
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
____________________________________________________________________________________
> > > Sucker-punch spam with award-winning protection.
>
> > > Try the free Yahoo! Mail Beta.
> > >
> >
>
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
> >
> > _______________________________________________
> > WebTest mailing list
> > [email protected]
> > http://lists.canoo.com/mailman/listinfo/webtest
> >
>
>
>
>
>
____________________________________________________________________________________
> It's here! Your new message!
> Get new email alerts with the free Yahoo! Toolbar.
> http://tools.search.yahoo.com/toolbar/features/mail/
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest