简体   繁体   中英

Find the hidden checkboxes in Coypu

I'm try to create test for my Bootstrap project. I'm use Coypu . But I ran into a some problem. I can't check my check-boxes. The problem is that I changed style form my check-box. And now standard Bootstraps check-boxes is hidden. The new check-box is hidden inside standard pattern:

 <label> 
     <input type="checkbox" data-bind="checkedValue: key, checked: $parent.selectedCatchments, attr: { id: key }" class="catchment-checkbox" />
 <span data-bind=" text: value, attr: { for: key }" class="lbl padding-8 openSans-Text catchment-checkbox-span"></span>
 </label>

The problem is that Coypu can't to find the hidden element on browser. And now I can't to check selected check-box or not.

This is standard check-box:

在此处输入图片说明

I turned off: opacity: 0 in CSS style. And this is new checkbox with the new style.

在此处输入图片说明

How can I check the number of checked items in Coypu?

I can add ConsideringInvisibleElements = true inside SetUp method, but this option will be works always for all Tests. How I can change value of ConsideringInvisibleElements option on true or false when I need inside test code?

I'm find this variant:

var catchmentsCheckboxes = Browser.FindAllXPath("id('catchmentsColumn')/div[1]/div/label/input", null, new Coypu.Options { ConsiderInvisibleElements = true });

The first parameter: xPath to element; The second parameter is can be null; The third parameter is ConsideringInvisibleElements. And we can change value of this parameter on true or false.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM