1

I am trying to automate a scenario using silk test and am very new to coding using vb.net. Basically i have a checkbox identified and want to set it to either true or false based on a string value being passed.

for e.g.

Dim tfnSigned As String
tfnSigned = "Yes"
If tfnSigned = "Yes"
Then .CheckBox("SED_TFNSignedCheckBox").Check
End If

In this case, i get a compiler error as .CheckBox is not identified as a class and hence cannot use the Check method

Kindly help

Cheers

2 Answers2

2

Checkboxes accepts only Boolean values which is either True or False.

The syntax is pretty much straightforward and can be easily found on Google

Here I assume that SED_TFNSignedCheckBox is the name of your checkbox control.

Dim tfnSigned As String
tfnSigned = "Yes"

If tfnSigned = "Yes" Then
     SED_TFNSignedCheckBox.Checked = True
End If
Aethan
  • 1,986
  • 2
  • 18
  • 25
1

To use the .Checkbox() method you need to be in the correct context, i.e. it should appear in a With..End With statement. the best way to get the syntax correct is to use the Silk Test Recorder to record a checking the checkbox, this will generate something like this.

With _desktop.Dialog("locator of dialog")
   .CheckBox("SED_TFNSignedCheckBox").Check
End With

So your complete code would look something like this ...

Dim tfnSigned As String
tfnSigned = "Yes"
If tfnSigned = "Yes" Then
  With _desktop.Dialog("locator of dialog")
    .CheckBox("SED_TFNSignedCheckBox").Check
  End With
End If

Hope that helps.

eggbox
  • 617
  • 4
  • 16