Issue with UFT checking/unchecking WebCheckBox

Category:
Question ID: 110059
2
0

Using UFT with a DataTable column “CheckboxStatus” with a Value of 1 or 0 (1 indicates checkbox is to be checked, 0 to be unchecked).

I try to use the following code to check the checkbox, but it is not working:

Browser(“Capital Gains”).Page(“Issue Distribution”).WebList(“Issue Selection”).WebCheckBox(“Checkbox”).Set datatable.Value(“CheckboxStatus”)

Marked as spam
Posted by (Questions: 361, Answers: 39)
Asked on January 29, 2021 4:42 pm
9 views
Answers (1)
2
Private answer

Change the DataTable values from 1 to ON or 0 to OFF and try do to this instead and see if it works:

Browser("Capital Gains").Page("Issue Distribution").WebList("Issue Selection").WebCheckBox("Checkbox").Set datatable.Value("CheckboxStatus")

If that doesn't work, try:

If Browser("Capital Gains").Page("Issue Distribution").WebList("Issue Selection").WebCheckBox("Checkbox").GetROProperty("checked") = 0 Then
Browser("Capital Gains").Page("Issue Distribution").WebList("Issue Selection").WebCheckBox("Checkbox").Click
End If

You can find more details on how to use the WebCheckBox at this link.

Marked as spam
Posted by (Questions: 16, Answers: 772)
Answered on January 29, 2021 4:50 pm
Both of the methods you mentioned work. Thanks!
( at January 29, 2021 4:52 pm)