They did a little more tests and achieved a satisfactory result. I did a couple of things that I suppose are inproper, namely, to set the value of the disabled attribute to invalid values ββtrue and false as follows:
$('input.submit').attr('disabled', true); $('input.submit').attr('disabled', false);
Looking at the specification of HTML forms , the attribute is disabled, as shown, does not take a value, and only its presence indicates that the element is disabled, Modifying my code for this and removing the attribute to indicate the activation of the element seems to have done the trick:
$('input.submit').attr('disabled', true); //This time we remove the disabled attribute rather than setting it to false. $('input.submit').removeAttr('disabled');
Note. I am still setting the value disabled to true , since I cannot determine how to set the attribute without setting the value, see this SO post for more details.
Using the above, I can now use Geb to state the status of disabled / activated elements as follows:
//Check that something is disabled. deleteSelectedButton.@disabled == 'true' //Check that something is enabled. deleteSelectedButton.@disabled == 'false'
Note. It seems that Geb requires a string literal indicating the expected status, and not a boolean, which iirc caused my statements to crash.
So, now everything works beautifully, and I'm running, writing loads of Geb tests! Hope this explanation is helpful to others.
Edd grant
source share