Micro Focus QTP (UFT) Forums
General Run error - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: General Run error (/Thread-General-Run-error--3890)



General Run error - Prema - 10-12-2010

Hi,
This is my code :
Code:
Browser("name:=Browser").Page("title:=Browser").Link("name:=Link Name").Click
Set desc = Description.Create()
desc("alt").Value = "Edit"
desc("html tag").Value = "IMG"
desc("image type").Value = "Image Link"
desc("name").Value = "Image"
desc("file name").Value = "edit.gif"
Set List =Browser("name:=Browser").Page("title:=Browser").ChildObjects(desc)     
NoOfChildObjs =  List.Count()
msgbox  NoOfChildObjs
For  i = 0  to NoOfChildObjs - 1
List(i).Click
Next

The script is executing for the first iteration ie when i=0 and on the second iteration i am getting a General run error in the line List(i).click.

I am new to descriptive programming.
Can any body help me ?


RE: General Run error - KavitaPriyaCR - 10-12-2010

Inside the loop
For i = 0 to NoOfChildObjs - 1
List(i).Click
Next
I guess mostly
1. after List(0).Click, application is navigating to some other screen OR
2. after this click action the child properties are changing, pls verify.
When you get this error, stop the test run and at this point use object spy to verify the child property if it is same as you have used while describing....for the 2nd possibility.


RE: General Run error - Prema - 10-12-2010

Hi,
I tried both the possibilities the child property is not getting chnged after the first iteration.
Is there any other option to do this?

by
Prema


RE: General Run error - KavitaPriyaCR - 10-12-2010

try by adding the micclass property in description
desc("micclass").value="Image"
Pls lemme know once done this


RE: General Run error - Prema - 10-12-2010

Sorry Kavita still i am getting the error in that statement....


RE: General Run error - KavitaPriyaCR - 10-12-2010

Hi Prema,
I tried the samething in my application, good news is that i am also getting the same error only if i attempt clicking that image.that means there is problem with properties of child/BrowserPage once we click for List(0).In my app, i have images with properties i have described below. This will display the name and file name(for me file names are different in my app). But if i add the line List(0).Click... will get the same error as u are getting now, From this we can understand that there is change in
Browser().Page(). -->> Pls look into this
Here i am pasting my script:
Code:
desc = Description.Create()
'desc("alt").Value = "Edit"                  
desc("html tag").Value = "IMG"
desc("image type").Value = "Image Link"
desc("name").Value = "Image"
'desc("file name").Value = "edit.gif"
Set List =Browser("title:=CFS - Search Trades").Page("title:=CFS - Search Trades").ChildObjects(desc)
' check Browser("title:=CFS - Search Trades").Page("title:=CFS - Search Trades")
NoOfChildObjs = List.Count()
msgbox NoOfChildObjs
For i = 0 to NoOfChildObjs - 1
'List(i).Click
MsgBox List(i).GetROProperty("name")
MsgBox List(i).GetROProperty("file name")
Next



RE: General Run error - Prema - 10-12-2010

Hi Kavita,
I thank u for ur effort and reply.
I agree with ur points.
The properties of the Browser().Page(). is getting changed.
I executed the script and stopped at the point where i got error then i used object spy to check the properties.
What i observed was
In the first iteration (ie List(0).click ) the object spy shows the property in the hierarcy
Browser->Page->WebTable1->WebTable2->WebTable3->WebTable4->Image:Edit

after the first iteration the object spy shows the property in the hierarcy
Browser->Page->WebTable1->WebTable2->WebTable3->WebTable4->WebTable5->Image:Edit

So i tried like this
For i = 0 to NoOfChildObjs - 1
Browser("name:=Browser").Page("title:=Browser").Link(name:=Link Name").Click ' to refresh the page
List(i).Click
Next

But still getting the same error.
Is there any other way to make click of the image.


RE: General Run error - KavitaPriyaCR - 10-12-2010

Hi Prema here is the solution, the reason is "Object is losing its property after first click", i donno the exact cause, let us find it out later. Meanwhile try this script, this will work.

Code:
Browser("name:=Browser").Page("title:=Browser").Link("name:=Link Name").Click
Set desc = Description.Create()
desc("alt").Value = "Edit"
desc("html tag").Value = "IMG"
desc("image type").Value = "Image Link"
desc("name").Value = "Image"
desc("file name").Value = "edit.gif"
Set List =Browser("name:=Browser").Page("title:=Browser").ChildObjects(desc)
NoOfChildObjs = List.Count()
msgbox NoOfChildObjs
For i = 0 to NoOfChildObjs - 1
List(i).Click
Set List =Browser("name:=Browser").Page("title:=Browser").ChildObjects(desc)
Next



RE: General Run error - Prema - 10-12-2010

Wow, Its working.
Thank u very much Kavita.

Regards
Prema.


RE: General Run error - KavitaPriyaCR - 10-12-2010

Smile WC Prema