Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Same command needs to be performed twice to actually perform it
#1
Solved: 10 Years, 7 Months, 3 Weeks ago
Hi!

I tried to find similar issues from the forum and via google, but didn't find any.

Anyways I'm a beginner with QTP and I need to fix some scripts that have been created by someone else.

The scripts are testing a web application (basically entering information to web forms using the QTP datatable).
I ran into two scripts where seems to be the same issue; for some reason the data is not entered on a specific field. I checked that the field name etc. is not changed, and if I simply add the same command on the script again the problem is solved.

There is an If expression before the command, if that makes any difference.

So, basically this doesn't enter the value in the field:
Code:
If DataTable("p_CarOwner", dtLocalSheet) = "OTHER" Then
Browser("Browser").Page("Form").WebEdit("ctl00$ContentPlaceHolderEForms_11").Set DataTable("p_OtherOwner", dtLocalSheet)
End If

But once done like this, the information is entered correctly:
Code:
If DataTable("p_CarOwner", dtLocalSheet) = "OTHER" Then
Browser("Browser").Page("Form").WebEdit("ctl00$ContentPlaceHolderEForms_11").Set DataTable("p_OtherOwner", dtLocalSheet)
Browser("Browser").Page("Form").WebEdit("ctl00$ContentPlaceHolderEForms_11").Set DataTable("p_OtherOwner", dtLocalSheet)
End If

Can anyone explain what is the issue here?

Regards, pistaa
Reply
#2
Solved: 10 Years, 7 Months, 3 Weeks ago
Try to use the debugger to debug the issue. You can then trace the flow and observe the variable values.

it could be an issue with blank cell on datatable or simply the inability for the object to set the value. When it traverses the If loop check if the value is returned from the datatable as such,

Code:
If DataTable("p_CarOwner", dtLocalSheet) = "OTHER" Then
msgbox DataTable("p_OtherOwner", dtLocalSheet)
Browser("Browser").Page("Form").WebEdit("ctl00$ContentPlaceHolderEForms_11").Set DataTable("p_OtherOwner", dtLocalSheet)
End If

Do you get a value you intend to set displayed in the msgbox? If yes, then you may need to learn about Settings.Webpackage("ReplayType").

If a blank value is being displayed then you may want to check your datatable and the cell it is fetching the value from.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 7 Months, 3 Weeks ago
Hi,

The Setting.WebPackage("ReplayType") seems to solve the issue. Thanks for the help! Smile

Regards, pistaa
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Telnet command not recognized Sanjana1987 1 2,107 09-20-2017, 03:16 PM
Last Post: Ankur
  WinListView set item command Shahino007 0 2,657 10-06-2015, 03:57 PM
Last Post: Shahino007
  Capturing the exact time when an operation is performed. Dilliz 2 3,119 01-09-2014, 03:30 PM
Last Post: Dilliz
  Perform some functions whenever QTP Stop button is pressed smartkarthi 2 3,259 08-22-2013, 11:43 AM
Last Post: smartkarthi
Exclamation Getting run time error while executing the QTP script in command prompt. vishruth143 1 5,724 07-15-2013, 05:41 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)