Checking a button for Disabled after jQuery

3 posts, 1 answers
  1. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 01 Dec 2010 Link to this post

    Ok, I have a control based on the asp:Wizard control.

    The last page of the wizard my jquery finds the finish button, then disables it so the user can't complete until something else on the page has occurred.

    So this is what I was going for in my Coded test
    HtmlInputSubmit FinishButtonSubmit = Pages.UndergradMedportalCa.FinishButtonSubmit;

    function checkSelectionCount() {
                var button = $('.finishbutton');
                var count = $('input[type="checkbox"]:checked', '.dailyevalStudent_container');
                if (count.length < 1) {
                    button.attr('disabled', 'disabled')
                else {
                return count.length;

    Although this is what the input html is like in firefox
    <input type="submit" class="finishbutton" id="FinishButton" value="Finish Evaluating Student" name="ctl00$content$dailyEvalForm$ctl02$FinishNavigationTemplateContainerID$FinishButton" disabled="">

    I always timeout waiting for the attribute...and a debug on that step shows there's definatly no Disabled attribute

    This is what the devtool in IE shows
    <input name="ctl00$content$dailyEvalForm$ctl02$FinishNavigationTemplateContainerID$FinishButton" disabled="disabled" class="finishbutton" id="FinishButton" type="submit" value="Finish Evaluating Student"/>

    Ideas? I doing it wrong?

    What do you think the odds of getting a quickvalidation "IsDisabled" or "IsEnabled" (not just Visible\not visible)
  2. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 01 Dec 2010 Link to this post

    The idea is (if you look at the script)...the button enables itself when at least 1 checkbox is clicked...but I'm a tad stumped on how to test that button....
  3. Answer
    Keaegan avatar
    126 posts

    Posted 02 Dec 2010 Link to this post

    Hi Steve,

    Try replacing your coded step with the following:

    HtmlInputSubmit FinishButtonSubmit = Pages.UndergradMedportalCa.FinishButtonSubmit;
    Wait.For<HtmlInputButton>(c => c.BaseElement.OuterMarkup.Contains("disabled"), Button, 10000);

    That should allow you to simply search the Outer Markup to contain "disabled", and continue on after the "disabled" markup has been found. OuterMarkup usually has a better track record on locating the "disabled" attribute (due to different browsers implementing it differently, as you saw with firefox). While different browsers will handle the disabled attribute differently, all of them will have the word "disabled" at least once if an attribute is actually disabled. 

    Conversely, you may also try modifying your following line:


    To read this instead:


    However, we would advise using our provided code for confirming the item is disabled. Please let us know if this setup does not perform better for you on this test. 

    the Telerik team

    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Back to Top