Micro Focus QTP (UFT) Forums
If/Else statement based off of CheckProperty - 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: If/Else statement based off of CheckProperty (/Thread-If-Else-statement-based-off-of-CheckProperty)



If/Else statement based off of CheckProperty - DanielElsner - 06-09-2011

I want to know how to write an If - Then statement based off of checking if something is editable or read only. How do I do this exactly?

What is wrong/missing from this...

Code:
[b]If [/b]Browser("Pavilion8 Console 3.7.2").Page("Pavilion8 Console.7.2").Frame("ControllerConfiguration2").WebEdit("CV1 Desired Coefficient").CheckProperty "class", "dashboard_editable" [b]Then[/b]
    Reporter.ReportEvent micPass, "APC 15: Is correctly set to editable"
    [b]Else[/b]
        Reporter.ReportEvent micFail, "APC 15: Is correctly set to read only"
    [b]End If[/b]



RE: If/Else statement based off of CheckProperty - tarun15 - 06-09-2011

You could either save the result of check property to a variable and then use that variable in your if else or use GetROProperty statement to get the run time property of the object, store that property to a variable and then compare this variable with the expected value of your property in if else block.


RE: If/Else statement based off of CheckProperty - rajpes - 07-05-2011

Code:
If Browser("Pavilion8 Console 3.7.2").Page("Pavilion8 Console.7.2").Frame("ControllerConfiguration2").WebEdit("CV1 Desired Coefficient").[b]GetRoProperty("disabled")=0 [/b]Then

Reporter.ReportEvent micPass, "APC 15: Is correctly set to editable"
Else
Reporter.ReportEvent micFail, "APC 15: Is correctly set to read only"
End If