Micro Focus QTP (UFT) Forums
How to access webtables without adding into Object Repository - 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: How to access webtables without adding into Object Repository (/Thread-How-to-access-webtables-without-adding-into-Object-Repository)



How to access webtables without adding into Object Repository - ramkumarad - 01-05-2012

Hi everybody,

My Scenario is as follows:

I have got a webpage which has got nearly 240 webtables. If the webtable count is going to be static, i would have added those into object repository. But, here, it changes daily. It may increase or decrease.

Each webtable has got few webelements and one image icon. I have verify the content of webelement and then click its image to open required page.

How can i do these without adding webtables in object Repository.

If there is any way of adding webtables dynamically to object repository. please suggest that also.

Thanks in advance,
Ramkumar A D


RE: How to access webtables without adding into Object Repository - sshukla12 - 01-05-2012

Hi,

Use descriptive programing for this.
Count the number of webtables in a webpage navigate either to all webtable or to the specific according to ur need and perform the action.

Hope this help you.

Regards,
Sankalp


RE: How to access webtables without adding into Object Repository - ramkumarad - 01-05-2012

Here is my code:

In the below code webtable("GBS") has to be replaced with new value of str for each for loop.

Issue is : How to add these webtables to object repository. Because i am getting the error as "Object GBS does not exist in object repository..."

Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebTable"
Set EditCollection = Browser("Inoplan2").Page("Inoplan2").Frame("Corpo").ChildObjects(oDesc)
NumberOfEdits = EditCollection.Count
For i = 6 to NumberOfEdits-1
    WebTableTitle = EditCollection(i).GetROProperty("column names")
    str=Mid(WebTableTitle ,2,(instr(2,WebTableTitle ,";")-2))
          'Browser("Inoplan2").Page("Inoplan2").Frame("Corpo").WebTable("GBS") 'Original table name
    Set myobj=Browser("Inoplan2").Page("Inoplan2").Frame("Corpo").WebTable(str)
    myobj.SetTOProperty "name" , EditCollection(i).GetROProperty("name")
    myobj.SetTOProperty "html id" , EditCollection(i).GetROProperty("html id")
    myobj.SetTOProperty "outertext",EditCollection(i).GetROProperty("outertext")
    myobj.RefreshObject
    msgbox myobj.RowCount
    Set myobj = Nothing
Next



RE: How to access webtables without adding into Object Repository - vinod123 - 01-06-2012

Get the count of the webtables by using GetROProperty and assign the value to variable and use it any where in the script as per your requirement


RE: How to access webtables without adding into Object Repository - akankhyap@yahoo.co.in - 01-07-2012

HI,

Its not a good idea to add the web tables to the OR as its dynamic in nature.
You need to use descriptive programming with regular expression to define the webtable. In your case you should use descriptive programming for "EditCollection" object and then re-run it. You should not get the error again.

Thanks
Akankhya


RE: How to access webtables without adding into Object Repository - Parke - 11-12-2013

ramkumarad

My understanding:
you have a webpage that has over 200 webtables.
the number of webtables changes daily.
names of the webtables changes daily.

Questions based on any one day:
Are the names of the frames constant?
How many frames are there?
Are all the tables in the same frame?
Within the same frame, what are the unique values, name, html id, outerhtml, etc? (on any one day)
Do all the tables have an image/link? (over 200?)
Is the image/link that you have to click constant or do the names/hrefs change on a daily basis?
In your for/next loop, you are starting from 6 rather than 0(zero) why? just curious.

We can easily find all the tables within a frame. After that, the question is what is a unique element within the tables, number of rows, number of columns, outerhtml, etc or a combination of things?

Parke


RE: How to access webtables without adding into Object Repository - Neo_Dawn - 12-30-2013

Hey just use regular expression for this issue.like you can use...
Code:
Set EditCollection = Browser(".*").Page(".*").Frame(".*").ChildObjects(oDesc)
Use above line code in your code .Hope it will work for you.


RE: How to access webtables without adding into Object Repository - Sathiya - 12-30-2013

Hi,
correct me i am wrong. Since you have more than 240 webtables you need to check from the first table ryt?
in the application somewhere it will show the tables count with page numbers ryt? as wells as with next and previous icons as buttons?
try to identify the page number and assign it to table count. then take the row count in each table and check for the required condition for example if the required condition satisfied in 5 row of 17page means do the mentioned action and exit the row count loop and page navigation loop.

got it? if no means mail me ill explain you.