[Webtest] Problem setting radio button (incl. Javascript)
Marc Guillemot
Marc Guillemot <mguillemot@yahoo.fr>
Tue, 15 Jan 2008 13:21:41 +0100
Hi,
can you provide the full stack trace?
Cheers,
Marc.
--
Blog: http://mguillem.wordpress.com
Christian Kölle wrote:
> Hi
>
> I have a strange problem with setting radio buttons in my test. After
> the step the radio button sometimes is set correctly and sometimes not.
> I wasn't able to find some regularities in the behavior. Without
> changing anything subsequent attempts succeed or fail.
>
> The only thing i've noticed is the following error message in the log file:
>
> [setRadioButton] ERROR (com.gargoylesoftware.htmlunit.html.HtmlForm) -
> org.jaxen.XPathSyntaxException: Expected: ]
>
> But this occurs every time (even if the setting succeeds).
>
> I've tried it with several webtest builds (1643, 1649 and some older
> ones) and get the same result. I work on a linux box with Java 1.5.
>
> Any hints?
>
> Thanks
> Christian
>
> -------------------------------------------------------------------------------
>
> The webtest script is like this:
>
> <storeXPath xpath="//tr[contains(td/a/text(),
> 'dn03-domain.ch')]/td/input[@type='radio' and starts-with(@name,
> 'selectedDeleteTimeItems')]/@name" property="deleteTime"/>
> <echo>------- Test:#{deleteTime}</echo>
> <setRadioButton name="#{deleteTime}" value="immediate"/>
>
> The radio button is defined like this:
>
> <input type="radio" value="immediate"
> name="selectedDeleteTimeItems['-375616497']"
> onClick="ConfirmSelectionAsync('dn0302ItemSelection.action;jsessionid=928342894623946','immediate','-375616497',this)"
> />
>
> The JavaScript function(s):
>
> function ConfirmSelectionAsync(actionname,type,id,ck) {
>
> var args = 'checktype='+type+'&pid='+id+'&selection='+ck.checked;
> SendConfirmation(actionname,args,true);
>
> }
>
>
> function SendConfirmation(actionname,args,synch) {
>
> var xmlHttp = false;
> // Internet Explorer
> try {
> xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
> } catch(e) {
> try {
> xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
> } catch(e) {
> xmlHttp = false;
> }
> }
> // Mozilla, Opera und Safari
> if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
> xmlHttp = new XMLHttpRequest();
> }
> if (xmlHttp) {
> xmlHttp.open('GET', actionname+'?'+args, synch);
> xmlHttp.onreadystatechange = function () {
> };
> xmlHttp.send(null);
> }
>
> return xmlHttp;
> }
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>