Sure:
1) Here is the html. (not sure how this will translate via mailing list, so
I'll wrap it in code.
<code>
<HTML><BODY>
<script type="text/javascript">
function addWorkTime(day) {
alert("STARTING JAVASCRIPT");
var test = "07";
alert(test);
alert("SUBSTRING");
alert(test.substring(0,2));
alert("REPLACE");
//change the 0 to "0" and it works.
alert(test.substring(0,2).replace(0, ""));
alert("REPLACED");
}
</script>
<input type="button" value="ruel" id="ruel" onclick="addWorkTime('monday');"
/>
</BODY>
</HTML>
</code>
2) here is my webtest:
<code>
<project name="ESO" default="test">
<property file="../properties/config.properties"/>
<target name="test">
<webtest name="Create Branch no Techs">
<invoke url="file:///c:/temp/htmlunit1/jstest.html"
description="Go to Branch page"/>
<clickButton htmlid="ruel" description="Click new
button"/>
</webtest>
</target>
</project>
</code>
3) here is my classpath:
wt.defineTasks.init:
[echo] |-- compile classpath
[echo] | |
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\activation-1.1.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\ant-1.6.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\ant-apache-bsf-1.6.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\ant-junit-1.6.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\ant-launcher.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\ant-nodeps-1.6.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\ant-trax-1.6.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\bsf-2.4.0.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\commons-codec-1.3.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\commons-collections-3.2.
jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\commons-httpclient-3.0.1
.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\commons-io-1.3.1.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\commons-lang-2.3.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\commons-logging-1.0.4.ja
r
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\dom4j-1.6.1.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\fontbox-0.1.0-dev-patche
d-20060622.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\groovy-all-1.0.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\htmlunit-1.13.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\icu4j-2.6.1.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\jaxen-1.1.1.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\jdom-1.0.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\jemmy-2.2.7.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\js-1.6R5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\jtds.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\junit-3.8.2.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\log4j-1.2.14.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\mail-1.4.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\nekohtml-0.9.5.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\oro-2.0.6.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\pdfbox-0.7.3-dev-log4j-2
0060612.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\poi-3.0.1-FINAL.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\webtest.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\webtest_T.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\xalan-2.6.0.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\xercesImpl-2.6.2.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\xml-apis-1.3.02.jar
[echo] | |-- C:\projects\esotest\WebTest\ESO\lib\xmlParserAPIs-2.2.1.jar
$
4) here is the output I see in webtest...you'll notice the final "REPLACED"
alert never hits.
[invoke] INFO (com.canoo.webtest.engine.WebClientContext) - Current response
now: file:/c:/temp/htmlunit1/jstest.html
[clickButton] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: clickButto
n "Click new button" (2/2)
[clickButton] INFO (com.canoo.webtest.steps.request.ClickButton) - -> findTarge
t(by input): name= value=ruel
[clickButton] WARN (com.gargoylesoftware.htmlunit.javascript.host.Window) - win
dow.alert("STARTING JAVASCRIPT") no alert handler installed
[clickButton] WARN (com.gargoylesoftware.htmlunit.javascript.host.Window) - win
dow.alert("07") no alert handler installed
[clickButton] WARN (com.gargoylesoftware.htmlunit.javascript.host.Window) - win
dow.alert("SUBSTRING") no alert handler installed
[clickButton] WARN (com.gargoylesoftware.htmlunit.javascript.host.Window) - win
dow.alert("07") no alert handler installed
[clickButton] WARN (com.gargoylesoftware.htmlunit.javascript.host.Window) - win
dow.alert("REPLACE") no alert handler installed
INFO (com.canoo.webtest.engine.WebClientContext) - Responses restored
INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest "Create B
ranch no Techs" (C:\projects\esotest\WebTest\ESO\tests\createBranchNoTech.xml:10
: )
INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully created.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Guillemot
Sent: Wednesday, December 05, 2007 9:49 AM
To: [email protected]
Subject: Re: [Webtest] javascript error - unexpected first parameter 0.0
Really strange. Can you provide a minimal html page that allows you to
reproduce the problem? As already said, the js example you sent worked
for me.
Marc.
--
Blog: http://mguillem.wordpress.com
Loehr, Ruel wrote:
> Version 1.6R5
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Guillemot
> Sent: Wednesday, December 05, 2007 9:42 AM
> To: [email protected]
> Subject: Re: [Webtest] javascript error - unexpected first parameter 0.0
>
> Rhino is js-xxx.jar
>
> Marc.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.14/1172 - Release Date: 12/5/2007
8:41 AM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.14/1172 - Release Date: 12/5/2007
8:41 AM
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest