I'm having trouble automating the clicking of a 'Submit' button that only becomes clickable after a specific action is taken. In this case, the user needs to click the TOS checkbox before the button can be clicked. I've been unable to find a selector that allows me to automate the clicking of the Submit button. Once the Submit button is clicked, a confirmation window pops up.
My setup involves using Protractor as the test runner in Webstorm. The test currently passes, but the Submit button isn't actually being clicked and no new account is created. I want to add an assertion, but I need help locating the element so it can be clicked. Both XPath and CSS selectors don't seem to work when automation is initiated.
This is the code snippet I've been trying to modify:
element(by.xpath('//*[@id="formHolderId"]/div/div/div[3]/span/button[2]')).click();
Before checking the TOS checkbox, the Inspect Element displays the following:
<button data-ng-click="modalOptions.ok(formData)" data-ng-disabled="formHolder.$invalid || formHolder.formHolder.$invalid" data-ng-if="modalOptions.actionButtonText" type="submit" class="btn btn-sm btn-submit ng-binding ng-scope ng-click-active" disabled="disabled">
Submit</button>
After checking the TOS checkbox, Inspect Element shows:
<button data-ng-click="modalOptions.ok(formData)" data-ng-disabled="formHolder.$invalid || formHolder.formHolder.$invalid" data-ng-if="modalOptions.actionButtonText" type="submit" class="btn btn-sm btn-submit ng-binding ng-scope ng-click-active">
Submit</button>
Even though the Submit button has disabled="disabled"
attribute when the TOS checkbox is unchecked, I'm still unable to make it clickable one way or another.