[Webtest] scriptStep query

Jaydeep Ayachit jaydeep_ayachit@persistent.co.in
Tue, 23 Sep 2008 20:13:45 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_0244_01C91DB8.E27F6EC0
Content-Type: text/plain;
	charset="us-ascii"
content-transfer-encoding: 7bit

Hello,

 

Does scriptStep supports html DOM objects?

I need to add option element to select control on the page dynamically. For
this I am using

 

<scriptStep language="javascript" >

     var new_option;

     new_option = document.createElement('option');

     new_option.value = "abc";

     new_option.text = "123";

     new_option.selected = true;

     document.userForm.orgUnit.options.add(new_option, null);

</scriptStep>

 

This however fails with error

 

Error invoking script: org.mozilla.javascript.EcmaError: TypeError: Cannot
find function createElement in object HtmlHtml[<html>]

 

If I use document.getElementById it gives the same error. Any help on this
is appreciated.

 

Regards

Jaydeep

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

------=_NextPart_000_0244_01C91DB8.E27F6EC0
Content-Type: text/html;
	charset="us-ascii"
content-transfer-encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sch=
emas-microsoft-com:office:word" xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman";}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Courier New";
	color:windowtext;
	font-weight:normal;
	font-style:normal;
	text-decoration:none none;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>Hello,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>Does scriptStep supports html DOM objects?<o:p></=
o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>I need to add option element to select control on
the page dynamically. For this I am using<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&lt;scriptStep language=3D&quot;javascript&quot;=
 &gt;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; var new_option;<o:p></o:=
p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; new_option =3D
document.createElement('option');<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; new_option.value =3D &#8=
220;abc&#8221;;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; new_option.text =3D &#82=
20;123&#8221;;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; new_option.selected =3D=
 true;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; document.userForm.orgUni=
t.options.add(new_option,
null);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>&lt;/scriptStep&gt;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>This however fails with error<o:p></o:p></span></=
font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>Error invoking script:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function createElem=
ent
in object HtmlHtml[&lt;html&gt;]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>If I use document.getElementById it gives the sam=
e
error. Any help on this is appreciated.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>Regards<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'>Jaydeep<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Courier New"><span style=3D'font=
-size:11.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

</div>

<p>DISCLAIMER=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
This e-mail may contain privileged and confidential information which is the=
 property of Persistent Systems Ltd. It is intended only for the use of the=
 individual or entity to which it is addressed. If you are not the intended=
 recipient, you are not authorized to read, retain, copy, print, distribute=
 or use this message. If you have received this communication in error, plea=
se notify the sender and delete all copies of this message. Persistent Syste=
ms Ltd. does not accept any liability for virus infected mails.</p>
</body>

</html>

------=_NextPart_000_0244_01C91DB8.E27F6EC0--