Micro Focus QTP (UFT) Forums
QTP not recognizing the webelement - 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: QTP not recognizing the webelement (/Thread-QTP-not-recognizing-the-webelement)



QTP not recognizing the webelement - vidya2k2 - 04-03-2015

Hi, I am trying to validate if a webelement property exists on the page or not. But QTP always returns true Sad and not going to Else part . Below is my code. pls help Sad
************************************************************
Code:
BlnResult = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").Exist(0) Then
Msgbox "Success"
Else
Msgbox "Fail"
End If
************************************************************
QTP always true even in case if web element doesn't exist on the page.


RE: QTP not recognizing the webelement - supputuri - 04-03-2015

check the x,y values of the webelement if the values are <0 then you can consider that the object does not exist on the page.
Below is the pseudo code....

Code:
BlnResult = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").Exist(0) Then
    intX = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").GetROProperty("X")
    intY = Browser("CDMS :: Master Agreement").Page("CDMS :: Master Agreement").WebElement("File Upload successfully").GetROProperty("Y")
    If (intX>0 and intY>0) then
        Msgbox "Success"
    Else
       Msgbox "Fail"
    End If
Else
    Msgbox "Fail"
End If



RE: QTP not recognizing the webelement - vidya2k2 - 04-04-2015

Hi,

values are positive only ... Moreover when i try to do object spy for the webelement (when the object doesnt exist on the page), QTP recognizes the page but not highlighting anything. Does it mean object exists on the page (like hidden)? Expectation is, QTP should throw a pop up saying "object doesn't exists on the application". Am i right ?


RE: QTP not recognizing the webelement - babu123 - 04-06-2015

try with this
Code:
WebElement("File Upload successfully").getroproperty("visible")