Home > DeveloperSection > Forums > Public object not being recognized by internal action
Mark Devid
Mark Devid

Total Post:102

Points:714
Posted on    June-20-2013 1:50 AM

 VB Script VB Script 
Ratings:


 1 Reply(s)
 733  View(s)
Rate this:
Hi Expert,

I am creating a script in QTP, it has a few internal actions (ActionA, ActionB...) and I have an associated function library commonFunctions.vbs

In my commonFunctions I have the code below:

Public PageA, PageB
Set PageA = Browser("A").Page("A")
Set PageB = Browser("A").Page("B")
And in ActionB (which is called by ActionA), I am making use of these Object variables:

If PageB.Link("someLink").Exist Then
    PageB.Link("someLink").Click
End If


ActionA and ActionB both have the object repository used by the variables.

When I run the test, I get the following error:

Object doesn't support this property or method: 'PageB.Link'
Line (4): "If PageB.Link("someLink").Exist Then".
What am I missing? How come the variables are not defined in ActionB?

I feel like this is something simple but I am not able to figure it out.

Any help on above is really appreciated.


Vijay Shukla

Total Post:100

Points:700
Posted on    June-20-2013 5:21 AM

Hi,

The issue doesn't appear to be the scope, but rather that sometimes QTP doesn't recognize the page object.

Try giving the condition explicitly like:

If Browser("A").Page("B").Link.Exists Then
-------------- code here ---------------

Also, this article may help a little:

Don't want to miss updates? Please click the below button!

Follow MindStick