Micro Focus QTP (UFT) Forums
help with script - 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: help with script (/Thread-help-with-script)



help with script - jorge.castro - 06-05-2012

Hello Guys.

Please I made the following script but after checking syntax in QTP it showed me the errors but I can not sort them out. please could you help me?

Code:
If Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("DAACC3303A").Exist(2)
                                And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Assigned").Exist(2)
                And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Cisco - WS-C2960...").Exist(2)
                And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Created on 04/24/2012").Exist(2)
                 And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").Link("BMW USA").Exist(2)
                 And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Terremark Networ...").Exist(2)
                 And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("SWITCH48X48_2").Exist(2)
                 And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Last Modified on 05/04/2012").Exist(2)

                Then
                a="Hello World"
                                                                MsgBox a
Else
                                                                b="Failure"

                                                                MsgBox b
End If




MsgBox a
Please I will appreciate any help.

Regards,


RE: help with script - ravs@788 - 06-05-2012

Hi Jorge,

What error are you facing? Can you provide a screenshot of the error?

Thank You,
Ravi Shankar


RE: help with script - supputuri - 06-05-2012

HI,

when ever we are continue our Line of Code in the next line then there should be a link (_) between the lines in order to consider it as a single statement.
Please find the below updated code.
Code:
If Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("DAACC3303A").Exist(2)_
And     Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Assigned").Exist(2) _
And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Cisco - WS-C2960...").Exist(2) _
And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Created on 04/24/2012").Exist(2)_
And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").Link("BMW USA").Exist(2)_
And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Terremark Networ...").Exist(2)_
And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("SWITCH48X48_2").Exist(2)_
And Browser("CMDB - InstanceMainDisplay").Page("CMDB - InstanceMainDisplay").WebElement("Last Modified on 05/04/2012").Exist(2) Then
a="Hello World"
MsgBox a
Else
b="Failure"

MsgBox b
End If




MsgBox a

Please let me know if you need any further information.