Micro Focus QTP (UFT) Forums
If statement with multiple conditions - 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 statement with multiple conditions (/Thread-If-statement-with-multiple-conditions)



If statement with multiple conditions - mv8167 - 08-16-2011

I need to check multiple of objects to determine which type of Preference dialog box was displayed. Can I use:

Code:
With Browser("Fax Request").Page("Preferences")

Code:
If (.WebElement("WebTable").Exist and .WebEdit("StartDate").Exist and .WebElement("mm/dd/yyyy").Exist and .WebCheckBox("CheckboxSave").Exist Then
...?



RE: If statement with multiple conditions - saranya Rangarajan - 08-19-2011

Hai Lorena,

If Possible please try this....

Code:
If Browser("Fax Request").Page("Preferences").WebElement("WebTable").Exist then
  
        If Browser("Fax Request").Page("Preferences").WebEdit("StartDate").Exist then

               If Browser("Fax Request").Page("Preferences").Web.....

               End If

        End If

   End If

Makes sense? Reply me if you have another logic.

Thanks,
Saranya


RE: If statement with multiple conditions - mv8167 - 08-19-2011

I will try your idea. Thx! I had thought about t6his but I was worried it would become a big mess. But my current way takes a long time for each multiple exist. Almost a minute per If statement. This is wayb to slow. I need the Prefrence page to be checked much faster. I will let you nknow how it goes.

Lor


RE: If statement with multiple conditions - mv8167 - 08-19-2011

I tried your suggestion, but it is still as slow as before. Maybe I will try using Exist(0)?


RE: If statement with multiple conditions - Arul - 08-20-2011

Lorena,
Try This
Code:
Dim oDialog:set oDialog=Dialog("text:=Login")

set obj1=description.Create()
set obj2=description.Create()
obj1("Micclass").Value="WinEdit"
obj2("Micclass").Value="WinButton"
set oCount=oDialog.Childobjects(obj1)
set oCount1=oDialog.Childobjects(obj2)
'Msgbox oCount
's=oCount.Coun
     If oCount.Count=1 then
         Msgbox"Editbox is exist"
    End if    
    If oCount1.Count=0 then
         Msgbox"Button is exist"
    End if


Thanks,
Arul.D