Webtable object identification on webpage
Hi all ,
I am working on a web application. Where on every page some webtables are used. Currently I'm identifying them using following properties:
1: Mandatory Props :
a> html tag
2: Assistive Props :
None
3: Smart Identification "On"
4: Ordinal Identifier :
a> Index
But my problem is that the webtables in our application continues to change this "Index" property , as per application's requirement. What will be a useful way to uniquely identifying "webtable" control????
Re: Webtable object identification on webpage
Try using text property with regular expressions as it would be sometimes very large
Re: Webtable object identification on webpage
Hi,
you can use ordinal identifier in order to recognize web table as a unique object in you application.
[B]What is Ordinal Identifier?[/B]
The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.
Use Tools --> Object Identification to define ordinal Identifer.
Cheers
[COLOR="Blue"][B]CPS[/B][/COLOR]
Re: Webtable object identification on webpage
Index is one of the Ordinal Identifiers, besides Location.
Please clarify more upon the application and how WebTables are treated. Is the location of WebTables changing after every successive build? Are more rows/cols being added etc.?
Re: Webtable object identification on webpage
Hi Anshoo ,
In our application , Index of the webtable is completely based on choices made from the filter screen. Means according to the filter choices the , after clicking "Submit" button , the webtables are made visible / invisible & that's why their Index property changes , as well as "Location" , the other ordinal identifier property , also gets changed. Another runtime property of webtable's object , that someone suggested to me was , "id". but again I'm getting balnk value for this property. So is there any unique property to identify webtables?
Re: Webtable object identification on webpage
I would simply suggest that first build your mandatory and assistive proerties set properly. Try to use more then property for mandatory and assistive properties. If this can not help then configure and use smart identification (smart identification is helpful when qtp is unable to identifiy an object or it match more then one object with the given description). In your case unique description is not being generated, so you can configure smart identification. If this solution still does not work then use index property of ordinal identifier. Moreover you can use regular expression to identify dynamically chagnging property values. You can also parameterize property values to handle dynamic objects. Cheers cps
Re: Webtable object identification on webpage
My suggestion is after clicking "Submit" button once the next page opens with the tables try to retrieve all the webtables in the page e.g.
Set objBrowserSync=Browser("SCC - Supply Chain Configurator_5").Page("SCC - Supply Chain Configurator")
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebRadioGroup"
Set Lists = objBrowserSync.ChildObjects(oDesc)
NumberOfLists = Lists.Count()
For i = 0 To NumberOfLists - 1
msgbox Lists(i).getroproperty("name")
Next
Then u might be able to check whether a specific table exists I hope
Re: Webtable object identification on webpage
Here is a code to count all WebTables in a page:
Set objValStore=Browser("micClass:=Browser").Page("micClass:=Page")
Set objWebTableDesc=Description.Create()
objWebTableDesc ("micclass").Value="WebTable"
set WebTableParent=objValStore.Childobjects(objWebTableDesc)
WebTableCount=WebTableParent.count
msgbox WebTableCount
Re: Webtable object identification on webpage
[QUOTE=Anshoo_Arora;23310]Count the number of WebTables every time on this particular page and use "If .. Then" statement to identify the WebTable at hand. Something like this:
' (Script) Count #s of WebTables
' If WebTables=Some_Number Then
' Do Action_1
' Else
' Do Action_2
' EndIf
*I am not able to edit the post above, so need to make a new one*
Could you please check if all the properties of the WebTables are the same? Check for properties like Innertext, name, etc. If even the innertext is different, we can make the script work for the WebTables. If not, you can count the number of WebTables, and depending upon the order, perform the necessary action on the WebTable that you want.[/QUOTE]
Hi This is Gaurav,
In my application WebTables index gets changes so frequently hence my script doesn't recognize those and I can't use Regular Expression since the same script I'm using on 7 languages and I don't find any property on which putting reg exp will be usefull even there is no other unique property to identify tables, please suggest me how can I overcome this issue..can't we overcome it by using advanced VB scripting, something like adding some properties explicitly to the web tables. Keeping count of all web tables on the page..will it help.., when there is addition of fw tables on the page and all the exising tables index gets increased respectively in that case this resolution is usefull..otherwise not ,..pls provide me the solution.