This is a migrated thread and some comments may be shown as answers.

Scripting step with IF/THEN/ELSE condition

2 Answers 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Helen
Top achievements
Rank 1
Helen asked on 28 Sep 2010, 02:06 PM

Hi

What I'm trying to do is verify if the checkbox is checked and if not - check it, else - simply run the webUI built-in checkbox verification.It keeps returning the syntax error in line right after THEN statement. What am I missing?

Here is how code looks like:

        Public Sub Change_Reason_CodedStep6()

            if Pages.Application.SilverlightApp.ChkIsActiveCheckbox.IsChecked = false then

                  (Pages.Application.SilverlightApp.ChkIsActiveCheckbox.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 6, 9, ArtOfTest.Common.OffsetReference.TopLeftCorner, ArtOfTest.Common.ActionPointUnitType.Pixel, CType(0,System.Windows.Forms.Keys)))

            else 
                    Assert.AreEqual(true, Pages.Application.SilverlightApp.ChkIsActiveCheckbox.IsChecked, "Property did not satisfy constraint")

            End if

        End Sub

I’ll appreciate any advice

 

Thanks in advance

Helen

2 Answers, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 28 Sep 2010, 06:23 PM
Hello Helen,

It looks like a problem of extra ( )'s. Try this instead:

Public Sub Change_Reason_CodedStep6()
    if Pages.Application.SilverlightApp.ChkIsActiveCheckbox.IsChecked = false then
          Pages.Application.SilverlightApp.ChkIsActiveCheckbox.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 6, 9, ArtOfTest.Common.OffsetReference.TopLeftCorner, ArtOfTest.Common.ActionPointUnitType.Pixel, CType(0,System.Windows.Forms.Keys))
    else
            Assert.AreEqual(true, Pages.Application.SilverlightApp.ChkIsActiveCheckbox.IsChecked, "Property did not satisfy constraint")
    End if
End Sub
 

Kind regards,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Helen
Top achievements
Rank 1
answered on 28 Sep 2010, 07:02 PM
Thanks a lot - removing ()'s helped!

Helen
Tags
General Discussions
Asked by
Helen
Top achievements
Rank 1
Answers by
Cody
Telerik team
Helen
Top achievements
Rank 1
Share this question
or