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

Checkbox triggered enable/disable not working during test.

2 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 2
Stuart asked on 02 May 2015, 04:33 AM

We have a page that enables some controls when a checkbox is checked.   Everything looks great when recording a test to validate that the controls are enabled, however when the test is run - the checkbox shows as checked - but the controls do not show as enabled.

 

Here's the javascript for enable/disable the controls:

<input name="_ctl0:ContentMain:tabGeneral:_hiddenPerformDetection" type="hidden" id="_ctl0_ContentMain_tabGeneral__hiddenPerformDetection" value="True" />
<script type="text/javascript">
    $(function () {        $('#_ctl0_ContentMain_tabGeneral__dataSourceIsActiveCheckBox').click(function () {            if (this.checked) {
                $('#_ctl0_ContentMain_tabGeneral__onUsDays').removeAttr('disabled');
                $('#_ctl0_ContentMain_tabGeneral__transitDays').removeAttr('disabled');
                $('#_ctl0_ContentMain_tabGeneral__defaultPriorityDropDown').removeAttr('disabled');
                $('#_ctl0_ContentMain_tabGeneral__imageSupportEnabledCheckBox').removeAttr('disabled');
                $('#_ctl0_ContentMain_tabGeneral__itemDetectionIsEnabledCheckBox').removeAttr('disabled');
                $('#_ctl0_ContentMain_tabGeneral__buttonsRow').removeAttr('disabled');            }
            else {
                $('#_ctl0_ContentMain_tabGeneral__onUsDays').attr('disabled', true);
                $('#_ctl0_ContentMain_tabGeneral__transitDays').attr('disabled', true);
                $('#_ctl0_ContentMain_tabGeneral__defaultPriorityDropDown').attr('disabled', true);
                $('#_ctl0_ContentMain_tabGeneral__imageSupportEnabledCheckBox').attr('disabled', true);
                $('#_ctl0_ContentMain_tabGeneral__itemDetectionIsEnabledCheckBox').attr('disabled', true);
                $('#_ctl0_ContentMain_tabGeneral__buttonsRow').attr('disabled', true);            }

 

Any help on getting this working would be appreciated.

 

Stuart.

2 Answers, 1 is accepted

Sort by
0
Stuart
Top achievements
Rank 2
answered on 02 May 2015, 12:31 PM

Ok found my own answer by a bit of experimenting.   While recording, rather than just clicking the checkbox, made the step a Mouse 'left click'.    That checked the box and triggered the click event, whereas just a standard recording of checking the checkbox and setting the javascript onclick event did not trigger the underlying javascript.

 

0
Boyan Boev
Telerik team
answered on 06 May 2015, 11:20 AM
Hello Stuart,

I am happy to hear that you have found a solution.

Please let us know if you need further assistance.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Stuart
Top achievements
Rank 2
Answers by
Stuart
Top achievements
Rank 2
Boyan Boev
Telerik team
Share this question
or