Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I have tried descriptive programming(DP) in QTP using terminal emulator. My code works when I code my script in static, but it fails when I code it in dynamic. It is unable to detect the field in the emulator even if after creating a dummy object and passing its values. Please help.


Static Descriptive Programming (This works):

TeWindow("short name:= A").TeScreen("input field count:=5").TeField("attached text:=USER").Set "USER"
TeWindow("short name:= A").TeScreen("input field count:=5").TeField("attached text:=Password").SetSecure "528ecce84d9dac2ab9ac05806f4c"
TeWindow("short name:= A").TeScreen("input field count:=5").SendKey TE_ENTER


Dynamic Descriptive Programming (This fails):

Set oTeWindow=description.Create
oTeWindow("micClass").value="TeWindow"
oTeWindow("protocol").value="5250"

Set oTeScreen=description.Create
oTeScreen("micClass").value="TeScreen"
oTeScreen("input field count").value="5"

Set oUsrEdit=description.Create
oUsrEdit("micClass").value="TeField"
oUsrEdit("attached text").value="User"

Set oPwdEdit=description.Create
oPwdEdit("micClass").value="TeField"
oPwdEdit("attached text").value="Password"

TeWindow(oTeWindow).TeScreen(oTeScreen).TeField(oUsrEdit).Set "USER"
TeWindow(oTeWindow).TeScreen(oTeScreen).TeField(oPwdEdit).SetSecure "528ecce84d9dac2ab9ac05806f4c"
TeWindow(oTeWindow).TeScreen(oTeScreen).SendKey TE_ENTER

Error message:
Cannot find the "[ TeField ]" object's parent "[ TeWindow ]" (class TeWindow). Verify that parent properties match an object currently displayed in your application.
Line (21): "TeWindow(oTeWindow).TeScreen(oTeScreen).TeField(oUsrEdit).Set "USER"".
Posted
Updated 22-Mar-17 0:20am

1 solution

Found Solution for this . Remove class property value and try as below.
Set oTeWindow=description.Create
oTeWindow("protocol").value="5250"

Set oTeScreen=description.Create
oTeScreen("input field count").value="5"

Set oUsrEdit=description.Create
oUsrEdit("attached text").value="User"

Set oPwdEdit=description.Create
oPwdEdit("attached text").value="Password"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900