2016-09-01 42 views
0

得到霜复选框状态我有一个霜冻复选框定义为:如何使用硒

<div id="protocol_input" class="ember-view frost-checkbox small"> 
<input id="protocol_input" class="input ember-view" type="checkbox"> 
    <label class="label" tabindex="0" for="protocol_input"> 
    Enable protocol 
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="3 2 31 31"> 
    <rect xmlns="http://www.w3.org/2000/svg" x="10.7" y="15.3" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 35.6974 26.188)" fill="%23009EEF" width="3.5" height="10.3"> 
    <polygon xmlns="http://www.w3.org/2000/svg" fill="%23009EEF" points="14.9,25.4 12.4,22.9 26.2,9.4 28.7,12.1"> 
    </svg> 
</label> 
</div> 

我可以使用硒,检查在标签/输入执行点击操作/取消选中的复选框,

但是,我必须得到它的状态,无论是否选择复选框。

选中复选框的属性在任何情况下都显示为false。

回答

0

你可以试着让checked属性,即使它不存在于HTML

//C# syntax 
string checkedValue = checkBox.GetAttribute("checked"); 
bool isChecked = checkedValue.Equals("true"); 
+0

不以这种方式工作:( – Dcode