Hello / Grüezi WebTest experts,
I am doing a <clickButton xpath="..."> on an HTML <button onclick="get(...)"
where that get JS function calls some stuff which ultimately tries to do this:
// Automagically resize the layer to needed space.
function resizeLayer(theLayer){
theLayer=theLayer?theLayer:$("someframe");
if (document.all){ // IE
theLayer.style.width = theLayer.document.body.scrollWidth;
theLayer.style.width = theLayer.document.body.scrollWidth; //IE needs
doublecheck
theLayer.style.height = theLayer.document.body.scrollHeight+10;
}else{ // FF
theLayer.style.width = theLayer.contentDocument.body.scrollWidth+19;
theLayer.style.height = theLayer.contentDocument.body.scrollHeight;
}
}
which causes the following error:
Wrapped com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read
property "body" from undefined (some.js#123) (...)
at submitForm(some.js:1638)
at get(some.js:1596)
at (onclick event for HtmlButton[<button class="iconbutton"
title="submit" onclick="get(...)">]:1)
where line 1638 is that "theLayer.style.width =
theLayer.Document.body.scrollWidth;" from above. If I understand this right,
the theLayer thing probably works, but theLayer.Document is undefined? I also
tried the FF version (just by changing the some.js file) and it reports the
same error, just in the line "theLayer.style.width =
theLayer.contentDocument.body.scrollWidth+19", so again does this probably
means the contentDocument is not defined?
My question is: In principle, is this kind of thing supposed to work - like
does HTMLUnit used by WebTest emulate a "full browser" where getting the
Document from a layer should be fine - or am I already reaching the limits
here?
Many thanks for any comments / ideas / etc. in advance!
PS: How/where can I "switch" to a "Firefox emulation" (does that exist?) so
that there is no document.all and it tries the else (without me changing the
.js code). I noticed a log line "INFO (com.canoo.webtest.engine.Configuration)
- Surfing with browser 4.0 (compatible; MSIE 6.0; Windows 98)", but that's just
the Agent probably. Where to change that, and if it's change, will the
document.all JS be different?
____________________________________________________________
This email and any files transmitted with it are CONFIDENTIAL and intended
solely for the use of the individual or entity to which they are addressed.
Any unauthorized copying, disclosure, or distribution of the material within
this email is strictly forbidden.
Any views or opinions presented within this e-mail are solely those of the
author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
An electronic message is not binding on its sender. Any message referring to
a binding engagement must be confirmed in writing and duly signed.
If you have received this email in error, please notify the sender immediately
and delete the original.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest