Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script gives syntax error in Flight reservation Application
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
Please see below script that i run in QTP 9.2 version. I want to parameterize and pass the value for "username" and password through my driver script.
Code:
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set  Datatable Value("username")
Dialog("Login").WinEdit("Agent Name:").Type  micTab
Dialog("Login").WinEdit("Password:").SetSecure Datatable Value("password")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Activate

while executing it gives me below error.

Error :

The test run cannot continue due to a syntax error.

Expected end of statement

Code:
Line (1): "Dialog("Login").WinEdit("Agent Name:").Set  Data table Value ("username")".
[/b]

Please help me out for this.

Thanks,
pnp
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
I think the error may be becz of extra line in the script
"Window("Flight Reservation").Activate".
Can you check it by removing this?
Regards,
Ram
Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
the correct syntax for retrieving data from datatable is Datatable(ParamID,Sheet) or Datatable.Value(ParamID,Sheet)
so you should use
Code:
Dialog("Login").WinEdit("Agent Name:").Set Datatable("username",dtLocalSheet)

if the Parameter 'username' is in your local sheet.

Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
tried with the saket solution but still get same error. I want to attach my script on fourm..Do I allow to do this ?
Script name: FR_demo-> which contains ( Login, Flight reservation, Open order and Logout scripts) . I will also attach my driver script. ( Test case 1).
Reply
#5
Solved: 11 Years, 4 Months, 4 Weeks ago
can you paste your modified code?
I dont think you need to attach all your QTP scripts here, only a piece of your statements should work or else a snapshot.

Reply
#6
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi,

You are missing .[dot] in datatable.value

Try the following and let us know.

Code:
"Dialog("Login").WinEdit("Agent Name:").Set Data table. Value ("username")".
Reply
#7
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi ,

As Tarik Suggested, you have missed .[dot]
ans also make sure that no blankspace given in word "Datatable"(ex: Data table is not allowed)

Try as given below.
Code:
Dialog("Login").WinEdit("Agent Name:").Set Datatable.Value("username",dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set Datatable.Value("password"dtGlobalSheet)

You can also use the below way too.

Code:
Dialog("Login").WinEdit("Agent Name:").Set Datatable.Value("username")
Dialog("Login").WinEdit("Password:").Set Datatable.Value("password")

Note: If we wont give 'sheetname' parameter then bydefault, QTP takes sheet as Globalsheet
Reply
#8
Solved: 11 Years, 4 Months, 4 Weeks ago
I tried with code givenby Tarik,

Code:
Dialog("Login").WinEdit("Agent Name:").Set Datatable.Value("username",dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set Datatable.Value("password"dtGlobalSheet)

Still another code without dtGlobalsheet give me error. but problem is resolved with above code.

Thanks to everyone for kind support.

Respect/Regards

Piyush
Reply
#9
Solved: 11 Years, 4 Months, 4 Weeks ago
Thats great, if you have sort out the issue, but again I can see a wrong statement there in the second line
',' is missing
Code:
Dialog("Login").WinEdit("Password:").Set Datatable.Value("password"dtGlobalSheet)
it should be
Dialog("Login").WinEdit("Password:").Set Datatable.Value("password",dtGlobalSheet)

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to send/pass UFT Run Error Dialog as output value to main driver script lravi4u 0 635 11-05-2023, 03:55 PM
Last Post: lravi4u
  error when executing an UFT automation script alexalloza 0 1,558 10-30-2018, 06:17 PM
Last Post: alexalloza
  UFT 12.53 trial version not recognizing its sample flight application login/password NehaRB 2 3,990 10-07-2016, 06:49 PM
Last Post: pradeep537
  Script is not generated for windows application in UFT sreelatha 1 2,406 04-04-2016, 10:51 AM
Last Post: vinod123
  Path of Flight reservation Window is not recorded in HP UFT 12.52 version mailtokopalverma@gmail.com 1 2,730 04-01-2016, 05:34 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)