Hi Michael,
seems to be an htmlunit bug here: for htmlunit the this in your js code
evaluates here to the link object whereas it should evaluate to the
window. And because a link has no document property, the execution fails.
Please open an htmlunit issue for this.
If you can change your html code this could simply be fixed, for
instance just by removing "this." or changing it to "window.".
Marc.
Michael Zwick wrote:
> Hi,
>
> I did not disable javascript support (at least not to my knowledge). I'm
> not sure how to use enableJavaScript. I tried:
>
> (1)
> <enableJavaScript enable="true" />
> <clickLink description="Click link"
> href="javascript:{this.document.form.p_spg_id.value = 2;
> this.document.form.submit()}"/>
>
> (2)
> <clickLink description="Click link"
> label="Page Display" />
>
> Both give the error:
>
> BUILD FAILED
> C:\WebTest\webtests\modules\selectPageDisplayTab.xml:14: Canoo Webtest:
> R_1393.
> Test failed.
> Test step clickLink
> (C:\WebTest\webtests\modules\selectPageDisplayTab.xml:43: ) named
> "Click link: Page Display" failed with message "Step[clickLink "Click
> link: Page Display" (5/5)]: Script error loading page executing webtest
> at: clickLink TypeError: Cannot read property "form" from undefined
> (Wrapper definition for javascript url#1)
> Source code:
> GargoyleWrapper0()"
>
> Michael
>
>
> Marc Guillemot wrote:
>
>> Hi,
>>
>> javascript is enabled by default, so <enableJavaScript enable="true"> is
>> only needed if you've disabled it previously.
>>
>> Most of the time it's not the safer way to identify a link by its href
>> but it shouldn't be the cause of the problem.
>>
>> What do you get for an error? Is the link not found or does an error
>> occur once it's clicked?
>>
>> Marc.
>>
>> Michael Habbert wrote:
>>
>>> Hi Michael,
>>>
>>> did you activate the execution of JavaScript?
>>>
>>> http://webtest.canoo.com/webtest/manual/enableJavaScript.html
>>>
>>> this might work.
>>>
>>> Michael
>>>
>>> Michael Zwick wrote:
>>>
>>>> Hi,
>>>>
>>>> On my HTML pages there are java scripts behind some of the links that
>>>> look like this:
>>>> href="javascript:{this.document.form.p_spg_id.value = 2;
>>>> this.document.form.submit()}"
>>>>
>>>> So I'm wondering how to access the pages or to "click these links".
>>>> The following doesn't do the job (but is exactly what I'd like to do):
>>>> <clickLink description="Click link"
>>>> href="javascript:{this.document.form.p_spg_id.value = 2;
>>>> this.document.form.submit()}" />
>>>>
>>>> Maybe the solution would be to somehow change the p_spg_id value
>>>> "manually" and submit the changed form?!
>>>>
>>>> I'd appreciate any help, many thanks in advance.
>>>>
>>> [...]
>>>
>>>
>>
>> _______________________________________________
>> WebTest mailing list
>> [email protected]
>> http://lists.canoo.com/mailman/listinfo/webtest
>>
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest