如何使用WATIR
检查该复选框<label title="Active-DC Cloud Management" class="custom-checkbox ng-scope folderSelector">
<span class="customCheckBox icn" ng-disabled="cDisabled">
<input class="ng-pristine ng-valid" ng-model="model" ng-change="changeCallback({$event:$event})" ng-disabled="cDisabled" type="checkbox">
</span> Active-DC Cloud Management<!-- ngIf: cFoldertype == 'ASP' || cFoldertype == 'VCE' || cFoldertype == 'CPL' -->
</label>
我尝试过使用以下内容但不起作用
@browser.label(:text,'Active-DC Cloud Management').parent.click
以下是更多HTMl代码
<li class="ng-scope" ng-repeat="subfolder in subfolder.subFolders" ng-class="{expandButton:subfolder.hasSubFolders,plus:subfolder.hasSubFolders, disabled:subfolder.folderAccess == 'NONE', selected:selectedFolderIdsArray.indexOf(subfolder.folderId) !== -1}" id="1001665955" ftpath="HOME\Order_12329753" ftname="Order_12329753" ftlevel="2" fttype="ORDER" ftaccess="VIEW">
<a name="&lpos=my : 263" href="javascript:void(0)" ng-click="toggleSelectFolder(subfolder.folderId,subfolder.fullFolderPath)" style="padding-left: 28px" data-this-tree="thisTree" complete-folder-stack="completeFolderStack" folder-data-ftype="subfolder.folderType">
<span class="expandCollapseIcon ng-hide" style="left: 15px" ng-show="subfolder.hasSubFolders" ng-click="expander($event,subfolder.folderAccess); ajaxLoad($event,subfolder)"> </span>
<label class="custom-checkbox ng-scope folderSelector">
<span class="customCheckBox icn" ng-disabled="cDisabled">
<input class="ng-valid ng-dirty" ng-model="model" ng-change="changeCallback({$event:$event})" ng-disabled="cDisabled" type="checkbox"></span>Order_12329753<!-- ngIf: cFoldertype == 'ASP' || cFoldertype == 'VCE' || cFoldertype == 'CPL' --></label></a>
<ul class="subfolder"><!-- ngRepeat: subfolder in subfolder.subFolders --></ul></li>
答案 0 :(得分:0)
好吧我觉得这部分似乎包含所有这些代码的div被设置为禁用(不可见)所以因为我不能使用与checkbox元素关联的常规函数但我可以使用fire_event浏览器点击复选框b.input(:xpath,"//label[@title='Active-DC Cloud Management']/span/input").fire_event :click