3 messages in com.canoo.lists.webtestRe: [Webtest] Is "javascript urls can...
FromSent OnAttachments
John and Pip21 Mar 2007 17:17 
Marc Guillemot26 Mar 2007 03:01 
John and Pip26 Mar 2007 04:14 
Subject:Re: [Webtest] Is "javascript urls can only be used to load content into frames and iframes" still not fixed?
From:Marc Guillemot (mgui@yahoo.fr)
Date:03/26/2007 03:01:43 AM
List:com.canoo.lists.webtest

Hi John,

can you open an htmlunit issue for this?

Marc.

PS: still evaluating or can I add Air NZ to my perhaps-one-day-ready WebTest users page? ;-)

John and Pip wrote:

Hi Guys,

I have an app I'm trying to test where the logon page uses an image map. ClickElement seems to get the right action which calls a javascript routine "checkValidation()" which then basically does document.forms[0].command.value="LOGON_ACTION"; document.forms[0].submit();

The result of this in IE6 is 1) an annoying little popup information window is opened, while 2) in the main window but with the same URL the content is changed to the user's home page.

However, webtest dies with a ""javascript urls can only be used to load content into frames and iframes" error which is coming from HTMLUnit WebClient.

Why and what can I do to get around this?

My script just does: <clickElement description="Go" xpath="//map/area[1]"/>

And the relevant part of the debug output is:

[clickElement] INFO (com.canoo.webtest.steps.request.AbstractTargetAction ) - -> gotoTarget by clickElement with xpath: //map/area[1] [clickElement] DEBUG (com.canoo.webtest.steps.request.ClickElement) - Looking for element with xpath "//map/area[1]" [clickElement] DEBUG (com.gargoylesoftware.htmlunit.WebClient ) - Get page for window named '', using WebRequestSettings[<url="javascript:checkValidation();", SubmitMethod[name=get], EncodingType[name=application/x-www-form-urlencoded], [], {}, null>] [clickElement] DEBUG ( com.canoo.webtest.steps.Step) - Step failed at C:\WebTest\doc\ifly\test.xml:17: with exception [clickElement] java.lang.IllegalArgumentException: javascript urls can only be used to load content into frames and iframes [clickElement] at
com.gargoylesoftware.htmlunit.WebClient.makeWebResponseForJavaScriptUrl(WebClient.java:1297)

I searched in nabble and found a discussion about the same issue over a year ago, where Marc said it was an issue that should be fixed. The poster said they had raised a defect but didn't give a reference and searching jira I can't find it. It seems the issue still exists and is a real showstopper for me, as no workaround was suggested and I can't get the code changed in the web application being tested.

Any help would be much appreciated.

regards, John Lockhart