codeceptjs / CodeceptJS

Supercharged End 2 End Testing Framework for NodeJS
http://codecept.io
MIT License
4.1k stars 722 forks source link

How to check if button is disable #478

Closed vitaly87 closed 7 years ago

vitaly87 commented 7 years ago

Hi. How can I check if a button is disable? I am trying to do something like

I.seeElement('[bo-submit]')->I.hasAttribute('disable');

but it isn't working.

DavertMik commented 7 years ago

seeElement with proper CSS/XPath selector should be enough. Attributes can be part of CSS selector so something like this will work:

I.seeElement('submit[disabled]');

Anyway, use interactive shell to figure out the best locator.

vitaly87 commented 7 years ago

hi @DavertMik , nope I get expected number of elements on a page '0' not to equal '0' the element html is :

<button id="input_1" bo-submit="bo-submit" type="button" ng-disabled="loginForm.$invalid || loginForm.$pristine" ng-click="vm.login()" class="btn btn-primary btn-flat ng-binding" disabled="disabled">login
        <!-- ngIf: vm.loginFailed -->
      </button>
implico commented 7 years ago

Rather: I.seeElement('[bo-submit]:disabled') or I.seeElement('[bo-submit]:not(:disabled)')

APshenkin commented 7 years ago

@vitaly87 Did you solved your issue? Looks like you just need correct CSS/XPath selector

Xpath e.g. //button[@id=input_1 and @disabled="disabled"]

APshenkin commented 7 years ago

Close due inactivity

rogoit commented 5 years ago

Works for me thank you!!

LuisaFRojas commented 4 months ago

Does this work with the appium helper?