Test Case

In My web page, I have 5 tabs (A,B,C,D,E) in which 2 tabs (A,B) are clickable and 3 Tabs(C,D,E) are not clickable.

Write a script to verify those tab elements are clickable or not.

What I've tried

1) expect(element(by.id(ID_of_UnCLICKABLE_menu)).isEnabled()).toBe(True); expect(element(by.id(ID_of_CLICKABLE_menu)).isEnabled()).toBe(True);

 Test passed for both unclickable and clickable elements. 
 **ExpectedResult** -> Need to fail for either of one.


2) var EC = protractor.ExpectedConditions;
   browser.driver.wait(EC.elementToBeClickable(element(by.id())), 5000, 'Not Clickable');

HTML code:

    <td id="id1234" class="name_style-button disabled" role='menuitem'>Text</td>

Note: This is a non-Angular page.

  • What is TorF in your first try? How does it fail in your first try? Thanks.
    – alecxe
    Commented Aug 31, 2017 at 14:42
  • Sorry for shorthand type. its True or False. Edited the description.
    – Bustaq
    Commented Sep 1, 2017 at 6:29
  • As you said. Test should fail for either of one. If so we can differentiate between clickable and non clickable elements.
    – Bustaq
    Commented Sep 1, 2017 at 6:36
  • I think in this case you would have to check against the class attribute, since that is what your application is using to manipulate that element. In addition, you would have to actually click it and also assert that clicking it does nothing or does something depending on what you expect. The html appears to show them as enabled even though your application, and the way they are displayed, has them disabled, so you can't check it through selenium through those conditions.
    – mrfreester
    Commented Sep 1, 2017 at 16:52
  • Try using elementToBeClickable()
    – DrZoo
    Commented Sep 2, 2017 at 6:02

1 Answer 1


First all, how should awnser if the tab is clickable or not? The tab itself.

So, in the tab page object, you should have a function like this:

function isClickable() {
   return this.getAttribute('class').contains('disable');

With this, in your test, you can get each tab and test it:


If you pass the locator for each tab into the Tab page object, it can be used for all tabs. This way, when the way the tabs get disabled change, you will need to change only the isClickable function.

  • You're welcome Keasav. Could you mark the answer as accepted? Commented Sep 6, 2017 at 16:38
  • 1
    Done.. The difference in html for Clickable and nonclickable was presence of Class=Disable for non clickable. So i written a code as Presence of xpath(class=disabled).toBe(true). Thanks
    – Bustaq
    Commented Sep 7, 2017 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.