Micro Focus QTP (UFT) Forums
Web Element - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Web Element (/Thread-Web-Element)



Web Element - raaj123 - 05-25-2012

hi,

In Search Panel "User Name" is Mandatory field.

if we not given "User Name" then system displaying validation message as ""Following fields have invalid data :User Role"", this validation message QTP identifying as Web Element Visible property as ""True""

if i given "User Name" then system displaying Search Result then QTP identifying as Web Element Visible property as ""Empty""

Code:
IF  element visible property = true then
   ""statement"'
Else
    "'statement"
end if

my problem is above if condition else is not working because of QTP identifying as Web Element Visible property as ""Empty""

there is no alternate to me.

please help me what to do.

Regards,
Praveen Raaj.


RE: Web Element - raaj123 - 05-29-2012

please help me anyone

Regards,
Praveen Raaj.


RE: Web Element - falvi - 05-29-2012

i am unable to understand your question, can you please elaborate your problem a little more?



RE: Web Element - mahalakshmi - 05-29-2012

yours question is not clear raj


RE: Web Element - raaj123 - 05-30-2012

hi,

In search Panel User Name is Mandatory field .

when i click on Search button for records of that user if i given User Name then system displaying records
else displaying validation as """Following fields have invalid data :User Role""'.

this validation message is identifying Qtp as webelement and property visible as ""True""


when ever records displaying then that webelement is not displaying and QTP is not identifying that object it returns visible property as nothing.

my problem is if condition is not working based on that webelement visible property.


please help me.

Regards,
Praveen Raaj.


RE: Web Element - falvi - 05-30-2012

My question to you here is , does QTP throw a runtime error, with description saying something like that "object not found" ?

and my suggestion would be to take a safer approach, and first check if the web element exists... just a example code idea...

Code:
if Browser().Page().WebElement().Exists(5) Then
   if Browser().page().WebElement().GetROProperty("visible") Then
      //Your code for when the element is visible
   Else
     //Your code for when element exists in the page but is not visible
Else
  //Your Code for when the element totally does not exist on the page

your problem might get solved this way around.