Micro Focus QTP (UFT) Forums

Full Version: QTP not recognizing the webelement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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
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 ?
try with this
Code:
WebElement("File Upload successfully").getroproperty("visible")