[Webtest] AJAX Support
Marc Guillemot
Marc Guillemot <mguillemot@yahoo.fr>
Tue, 10 Apr 2007 16:23:16 +0200
this was due to a bug in htmlunit concerning handling of out of bound
indexes for options array. This is now fixed (you have to get latest
sources of htmlunit by yourself in a first time).
Marc.
Michal wrote:
> Any news on this topic?
>
> Michal wrote:
>> Sorry missed some stuff...
>>
>> Relevant test case:
>> <invoke url="test2.php"/> <setSelectField
>> description="Select role"
>> htmlid="role"
>> text="Role 2"
>> />
>> <sleep description="5s pause" seconds="5" />
>> <setSelectField
>> description="Select person"
>> htmlid="person"
>> value="Manager"
>> />
>>
>>
>> Here is the error:
>>
>> [invoke] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
>> invoke (5/8)
>> [invoke] INFO
>> (com.canoo.webtest.steps.request.AbstractTargetAction) - -> gotoTarget
>> by URL: test2.php
>> [invoke] INFO (com.canoo.webtest.steps.request.TargetHelper) -
>> getting response for url: http://host/wert/test2.php
>> [invoke] INFO (com.canoo.webtest.engine.WebClientContext) - Content
>> of window changed to http://host/wert/test2.php (text/html)
>> [invoke] INFO (com.canoo.webtest.engine.WebClientContext) - Content
>> of current window changed, it will become current response
>> [invoke] INFO (com.canoo.webtest.engine.WebClientContext) - Current
>> form set to none
>> [invoke] INFO (com.canoo.webtest.engine.WebClientContext) - Current
>> response now: http://host/wert/test2.php
>> [setSelectField] INFO (com.canoo.webtest.steps.Step) - >>>> Start
>> Step: setSelectField "Select role" (6/8)
>> [sleep] java.lang.NullPointerException
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.OptionsArray.get(OptionsArray.java:97)
>>
>> [sleep] at
>> org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1343)
>>
>> [sleep] at
>> org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1304)
>>
>> [sleep] at
>> org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1288)
>>
>> [sleep] at
>> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2846)
>> [sleep] at
>> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
>> [sleep] at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
>>
>> [sleep] at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:151)
>>
>> [sleep] at
>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
>> [sleep] at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:159)
>>
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:363)
>>
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:145)
>>
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:375)
>>
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.access$000(XMLHttpRequest.java:72)
>>
>> [sleep] at
>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest$1.run(XMLHttpRequest.java:328)
>>
>> [sleep] at java.lang.Thread.run(Thread.java:570)
>> [sleep] at
>> com.gargoylesoftware.htmlunit.ThreadManager$1.run(ThreadManager.java:118)
>> [setSelectField] INFO (com.canoo.webtest.steps.Step) - >>>> Start
>> Step: setSelectField "Select person" (8/8)
>> [setSelectField] INFO (com.canoo.webtest.steps.Step) - Running with:
>> Canoo Webtest: R_1537.
>> [setSelectField] INFO (com.canoo.webtest.steps.Step) - Exception
>> thrown from this class: com.canoo.webtest.engine.StepFailedException
>> [setSelectField] INFO (com.canoo.webtest.steps.Step) - Message was:
>> No option found matching criteria in select HtmlSelect[<select
>> name="person" id="person">]
>> INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest:
>> R_1537.
>> INFO (com.canoo.webtest.steps.Step) - Exception thrown from this
>> class: com.canoo.webtest.engine.StepFailedException
>> INFO (com.canoo.webtest.steps.Step) - Message was: No option found
>> matching criteria in select HtmlSelect[<select name="person"
>> id="person">]
>> INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest
>> "My description" (/home/kralik/apps/test/tests/wert/tasks/form0.xml:11: )
>> INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully
>> created.
>>
>> As you can see, this throws the NullPointerException and doesn't work
>> with ajax :/
>>
>>
>>
>> Marc Guillemot wrote:
>>> really strange.
>>>
>>> Can you provide the smallest html+js file allowing to reproduce your
>>> error?
>>>
>>> Marc.
>>>
>>> uhmm wrote:
>>>
>>>> I searched using find / -iname "*htmlunit*" and I found only one on
>>>> the whole disk. Version 1.11
>>>>
>>>>
>>>> Thursday, April 5, 2007, 9:01:13 AM, you wrote:
>>>>
>>>> MG> Have you searched on your whole disk for htmlunit*.jar?
>>>>
>>>> MG> Marc.
>>>>
>>>> MG> uhmm@1234.sk wrote:
>>>>
>>>>>> How can I find out if it is a classpath problem? There so no
>>>>>> other htmlunit code on the machine.
>>>>>>
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: Marc Guillemot <mguillemot@yahoo.fr>
>>>>>> To: webtest@lists.canoo.com
>>>>>> Subject: Re: [Webtest] AJAX Support
>>>>>> Date: Wed, 4 Apr 2007 06:05:56 -0700 (PDT)
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I think that you have some classpath problem and that an
>>>>>>> older version of htmlunit is used because in htmlunit 1.11
>>>>>>> (the one now provided with WebTest) no
>>>>>>> NullPointerException can occur at line 102 of
>>>>>>> OptionsArray.
>>>>>>>
>>>>>>> Marc.
>>>>>>>
>>>>>>>
>>>>>>> uhmm@1234.sk wrote:
>>>>>>>
>>>>>>>> Hey there,
>>>>>>>> I've been looking around internet for ajax support in
>>>>>>>> webtest, but
>>>>>>>> haven't found anything what would help me. Hope people
>>>>>>>> here can...
>>>>>>>>
>>>>>>>> I have school example of ajax usage. 2 dropdowns, first
>>>>>>>> one is
>>>>>>>> changed, second one is updated. How shall I create test
>>>>>>>> steps?
>>>>>>>>
>>>>>>>> Easy it may seem, but it's not. Here is my try:
>>>>>>>>
>>>>>>>> <setSelectField
>>>>>>>> description="Select offering type"
>>>>>>>> htmlid="fOfferingType"
>>>>>>>> text="Application Support"
>>>>>>>> />
>>>>>>>> <sleep description="12s pause" seconds="12" />
>>>>>>>> <setSelectField
>>>>>>>> description="Select offering subtype"
>>>>>>>> htmlid="fOfferingSubtype"
>>>>>>>> value="Other"
>>>>>>>> />
>>>>>>>>
>>>>>>>> Errors I'm getting:
>>>>>>>> [setSelectField] INFO (com.canoo.webtest.steps.Step) -
>>>>>>>>
>>>>>>>>>>>> Start
>>>>>>>>>>>>
>>>>>>>> Step: setSelectField "Select offering type" (13/15)
>>>>>>>> [sleep] java.lang.NullPointerException
>>>>>>>> [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.OptionsArray.get(
>>>>>>>
>>>>>>>> OptionsArray.java:102) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.ScriptableObject.getProperty(Script
>>>>>>>
>>>>>>>> ableObject.java:1343) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptR
>>>>>>>
>>>>>>>> untime.java:1304) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptR
>>>>>>>
>>>>>>>> untime.java:1288) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.Interpreter.interpretLoop(Interpret
>>>>>>>
>>>>>>>> er.java(Compiled Code))
>>>>>>>> [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.Interpreter.interpret(Interpreter.j
>>>>>>>
>>>>>>>> ava:2251) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.InterpretedFunction.call(Interprete
>>>>>>>
>>>>>>>> dFunction.java:161) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFac
>>>>>>>
>>>>>>>> tory.java:340) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFa
>>>>>>>
>>>>>>>> ctory.doTopCall(HtmlUnitContextFactory.java:151)
>>>>>>>> [sleep] at
>>>>>>>>
>>>>>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRunti
>>>>>>>
>>>>>>>> me.java:2758) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> org.mozilla.javascript.InterpretedFunction.call(Interprete
>>>>>>>
>>>>>>>> dFunction.java:159) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.
>>>>>>>
>>>>>>>> callFunction(JavaScriptEngine.java:363) [sleep] at
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpReque
>>>>>>>
>>>>>>>> st.setState(XMLHttpRequest.java:145) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpReque
>>>>>>>
>>>>>>>> st.doSend(XMLHttpRequest.java:375) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpReque
>>>>>>>
>>>>>>>> st.access$000(XMLHttpRequest.java:72) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpReque
>>>>>>>
>>>>>>>> st$1.run(XMLHttpRequest.java:328) [sleep] at
>>>>>>>> java.lang.Thread.run(Thread.java:570) [sleep] at
>>>>>>>>
>>>>>>>>
>>>>>>> com.gargoylesoftware.htmlunit.ThreadManager$1.run(ThreadMa
>>>>>>>
>>>>>>>> nager.java:118) [setSelectField] INFO
>>>>>>>> (com.canoo.webtest.steps.Step) - >>>> Start
>>>>>>>> Step: setSelectField "Select offering subtype" (15/15)
>>>>>>>> [setSelectField] INFO (com.canoo.webtest.steps.Step) -
>>>>>>>> Running with:
>>>>>>>> Canoo Webtest: R_1537.
>>>>>>>> [setSelectField] INFO (com.canoo.webtest.steps.Step) -
>>>>>>>> Exception
>>>>>>>> thrown from this class:
>>>>>>>> com.canoo.webtest.engine.StepFailedException
>>>>>>>> [setSelectField] INFO (com.canoo.webtest.steps.Step) -
>>>>>>>> Message was:
>>>>>>>> No option found matching criteria in select
>>>>>>>> HtmlSelect[<select
>>>>>>>> name="fOfferingSubtype" id="fOfferingSubtype"
>>>>>>>> class="body-text-small "
>>>>>>>> onchange="showRelevantCountries();">]
>>>>>>>> INFO (com.canoo.webtest.steps.Step) - Running with:
>>>>>>>> Canoo Webtest: R_1537.
>>>>>>>> INFO (com.canoo.webtest.steps.Step) - Exception thrown
>>>>>>>> from this
>>>>>>>> class: com.canoo.webtest.engine.StepFailedException
>>>>>>>> INFO (com.canoo.webtest.steps.Step) - Message was: No
>>>>>>>> option found
>>>>>>>> matching criteria in select HtmlSelect[<select
>>>>>>>> name="fOfferingSubtype"
>>>>>>>> id="fOfferingSubtype" class="body-text-small "
>>>>>>>> onchange="showRelevantCountries();">]
>>>>>>>>
>>>>>>>>
>>>>>>>> What is wrong? As you can see I have the latest Webtest
>>>>>>>> revision with
>>>>>>>> latest HtmlUnit...
>>>>>>>> Exception coming out of sleep?
>>>>>>>>
>>>>>>>> Your help is very appreciated!
>>>>>>>> _______________________________________________
>>>>>>>> WebTest mailing list
>>>>>>>> WebTest@lists.canoo.com
>>>>>>>> http://lists.canoo.com/mailman/listinfo/webtest
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/AJAX-Support-tf3525274.html#a9836506
>>>>>>> Sent from the WebTest mailing list archive at Nabble.com.
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> WebTest mailing list
>>>>>>> WebTest@lists.canoo.com
>>>>>>> http://lists.canoo.com/mailman/listinfo/webtest
>>>>>>>
>>>>>> _______________________________________________
>>>>>> WebTest mailing list
>>>>>> WebTest@lists.canoo.com
>>>>>> http://lists.canoo.com/mailman/listinfo/webtest
>>>>>>
>>>>>>
>>>> MG> _______________________________________________
>>>> MG> WebTest mailing list
>>>> MG> WebTest@lists.canoo.com
>>>> MG> http://lists.canoo.com/mailman/listinfo/webtest
>>>>
>>>>
>>>> _______________________________________________
>>>> WebTest mailing list
>>>> WebTest@lists.canoo.com
>>>> http://lists.canoo.com/mailman/listinfo/webtest
>>>>
>>>>
>>>
>>> _______________________________________________
>>> WebTest mailing list
>>> WebTest@lists.canoo.com
>>> http://lists.canoo.com/mailman/listinfo/webtest
>>>
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> WebTest mailing list
>> WebTest@lists.canoo.com
>> http://lists.canoo.com/mailman/listinfo/webtest
>>
>>
>>
>
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>