Micro Focus QTP (UFT) Forums
Way to check if a table is visible - 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: Way to check if a table is visible (/Thread-Way-to-check-if-a-table-is-visible)



Way to check if a table is visible - mv8167 - 02-03-2012

I need a better way to check if a table is visible or not. Currently, if the WebTable is not visible, I open it. I determine which WebTable is needed by finding the "html id" but so far, my code always triggers.

My code is such:

Code:
NGNum = Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebTable("innertext:=" & GroupName &".*", "visible:=True").WebTable("innertext:=" & "Document Type.*", "visible:=True").GetROProperty("html id")

If Not Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebTable("innertext:=" & GroupName &".*").WebTable("innertext:=" & "Document Type.*", "visible:=True", "html id:=" & NGNum ).Exist(0) Then
                Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:=" & GroupName, "visible:=True").Click
Can anyone give me a better idea?

thx ;-)


RE: Way to check if a table is visible - rajpes - 02-06-2012

Code:
set desc=description.create
desc("micclass").value="WebTable"
desc("innertext").value="GroupName.*"
desc("visible").value="True"

If b().p().webtable(desc).exist then
Browser("Wisdom").Page("Wisdom IA").Frame("parent").Link("name:=" & GroupName, "visible:=True").Click
end if



RE: Way to check if a table is visible - mv8167 - 02-06-2012

Rajpes,

You always give me such great ideas to try, including this time, thank you.

However, ;-) for whatever reason, even though I cant see the table, visible always will equal True. The code always is found to be True even if the table is hidden to the eye.

So I chatted with the developer on how they view and hide tables when we are looking at them.

His responce: "Look for the object with the name=“NestedGridx”. Check to see if there is a “style” property on that object. We are setting:

• style=”display:none;” – to hide the table
• style=”display:block;” – to show the table

If none of that exists, then QTP is probably providing an equivalent object/property with a different name – like a “visible:=True” which under the covers really is style=”display:block;”. All I can give you is what is actually happening in Image Access. From there, you’ll have to dig into QTP help to figure out how it exposes this."

I of course can see the Property of visble using QtP. I tried set to False then my code is always skipped, if True the code always run.

Have you had any similar issues to resolve before?

thx Rajpes


RE: Way to check if a table is visible - rajpes - 02-07-2012

check if any of these works
Code:
if  b().p().webtable().object.style="display:none;" then msgbox "hidden table"
if  b().p().webtable().object.currentstyle="display:none;"then msgbox "hidden table"



RE: Way to check if a table is visible - mv8167 - 02-07-2012

Thx Rajpes

With a little more resarch of your solution, i beleive i figured it out;

If Browser().Page().Frame().WebTable( "html id:=" & NGNum ).object.style.display = "none" Then

thx, ur the best