I have a problem how to check if the button is disabled. If button is disabled and I use
Assert.IsTrue(driver.FindElement(By.XPath(OKButton)).Enabled, "OK button is disabled.");
it is not finds that button is disabled.
If same button is enabled and I use
Assert.IsFalse(driver.FindElement(By.XPath(OKButton)).Enabled, "OK button is enabled.");
it is finds that button is enabled.
Here is a code for disabled button:
<div id="expBtnOK" class="dxbButton_MetropolisBlue button btn-primaryOk dxbButtonSys dxbTSys dxbDisabled_MetropolisBlue" style="width:80px;-moz-user-select:none;">
<div id="expBtnOK_CD" class="dxb">
<input class="dxb-hb" value="OK" name="expBtnOK" disabled="" type="button"/>
<span class="dx-vam">OK</span>
</div>
</div>
<script id="dxss_381722429" type="text/javascript"> <!-- aspxAddHoverItems('expBtnOK',[[['dxbButtonHover_MetropolisBlue'],[''],[''],['','TC']]]); aspxAddPressedItems('expBtnOK',[[['dxbButtonPressed_MetropolisBlue'],[''],[''],['','TC']]]); aspxAddDisabledItems('expBtnOK',[[['dxbDisabled_MetropolisBlue'],[''],[''],['','TC']]]); var dxo = new MVCxClientButton('expBtnOK'); window['expBtnOK'] = dxo; dxo.Click.AddHandler(ExportTo); aspxAddSelectedItems('expBtnOK',[[['dxbf'],[''],['CD']]]); dxo.useSubmitBehavior = false; dxo.AfterCreate(); //--> </script>
And a code for enabled button:
<div id="expBtnOK" class="dxbButton_MetropolisBlue button btn-primaryOk dxbButtonSys dxbTSys dxbButtonHover_MetropolisBlue" style="width:80px;-moz-user-select:none;">
<div id="expBtnOK_CD" class="dxb">
<input class="dxb-hb" value="OK" name="expBtnOK" type="button"/>
<span class="dx-vam">OK</span>
</div>
</div>
<script id="dxss_381722429" type="text/javascript"> <!-- aspxAddHoverItems('expBtnOK',[[['dxbButtonHover_MetropolisBlue'],[''],[''],['','TC']]]); aspxAddPressedItems('expBtnOK',[[['dxbButtonPressed_MetropolisBlue'],[''],[''],['','TC']]]); aspxAddDisabledItems('expBtnOK',[[['dxbDisabled_MetropolisBlue'],[''],[''],['','TC']]]); var dxo = new MVCxClientButton('expBtnOK'); window['expBtnOK'] = dxo; dxo.Click.AddHandler(ExportTo); aspxAddSelectedItems('expBtnOK',[[['dxbf'],[''],['CD']]]); dxo.useSubmitBehavior = false; dxo.AfterCreate(); //--> </script>
Thanks in advance for your help.