Micro Focus QTP (UFT) Forums
How to get a specific image inside a webtable - 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 get a specific image inside a webtable (/Thread-How-to-get-a-specific-image-inside-a-webtable)



How to get a specific image inside a webtable - grave711 - 05-25-2012

Hi,
I'm having a problem getting a specific image inside a dynamic webtable.

There are 6 Columns and 21 Rows in the webtable.
In the 1st column, there are 1 checkbox and 3 images.
I want to get the 1st image on that column.
Can you help me how to retrieve the image.

Thanks


RE: How to get a specific image inside a webtable - sshukla12 - 05-25-2012

Hi,

U can use Browser().Page().webtable().childItem()
Specify the class and index for the image with cell address.

Let me know in case u need any further help.

Regards,
Sankalp


RE: How to get a specific image inside a webtable - grave711 - 05-28-2012

Thanks sir Sankalp,
Can you fill the question mark for the childItem parameters.
in page().webtable().childItem(2,2,"Image",0)
2 - ?
2 - ?
Image - class
0 - ?

Thanks



RE: How to get a specific image inside a webtable - kotaramamohana - 05-28-2012

Please find answers for your question

2 - Row no
2 - Col no
Image - class
0 - Index no


RE: How to get a specific image inside a webtable - grave711 - 05-28-2012

Thanks! Smile


RE: How to get a specific image inside a webtable - grave711 - 05-29-2012

Hi,
I have another problem, when I used childItem and childItemCount, I encountered "Object required".
Below is my code:

Code:
rWebBox = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("micclass:=WebTable", "name:=checkAll").RowCount

For i=1 to rWebBox
    cWebBox = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("micclass:=WebTable", "name:=checkAll").childItemCount(i,1, "Image")
        For j=0 to cWebBox
            Set iWebBox = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("micclass:=WebTable", "name:=checkAll").childItem(i,1, "Image", cWebBox)
                roWebBox = iWebBox.getROProperty("alt")
        Next
Next

Below is the code which QTP says "Object Required":
Code:
Set iWebBox = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("micclass:=WebTable", "name:=checkAll").childItem(i,1, "Image", cWebBox)

Can you help me to solve this.

Thanks, Smile


RE: How to get a specific image inside a webtable - kotaramamohana - 05-29-2012

Image may not be available in 0th Row with 1st Column. Can you check it once from which row and which column Images are available in webtable.


RE: How to get a specific image inside a webtable - grave711 - 05-29-2012

Thanks,
My counter for Index for childItem was the one making the error.
It must be like this instead of the code above:
Code:
Set iWebBox = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("micclass:=WebTable", "name:=checkAll").childItem(i,1, "Image", j)

Thanks again. Smile