How to get current value of a On/Off switch having On & Off labels?
The HTML code for this switch is as follow-
<div class="make-switch has-switch">
<div class="switch-on switch-animate">
<input type="checkbox" data-bind="switch: DegreeSetting, switchOptions: { onLabel: 'F', offLabel: 'C' }">
<span class="switch-left">F</span>
<label> </label>
<span class="switch-right">C</span>
I tried the following code, but is always goes in else case-
boolean isChecked = "true".equals(driver.findElement (By.xpath("given xpath of class="switch-on switch-animate")).getAttribute("Checked"));
if (isChecked){
Log.info("Current F/C setting is : F" );
}else{
Log.info("Current F/C setting is : C" );
}