# Unable to click Object despite verifyElementClickable returning true

**URL:** <https://forum.katalon.com/t/unable-to-click-object-despite-verifyelementclickable-returning-true/49699>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [November 30, 2020, 2:05am UTC](https://forum.katalon.com/t/unable-to-click-object-despite-verifyelementclickable-returning-true/49699 "2020-11-30T02:05:26Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [December 1, 2020, 1:14am UTC](https://forum.katalon.com/t/unable-to-click-object-despite-verifyelementclickable-returning-true/49699/21 "2020-12-01T01:14:48Z")

</div>

You can make your XPath expressions better.

## Context

You have this HTML fragment in your target web page:

```auto
    <div class="nav-bar-collapse collapse">
        <ul>
            <li>...</li>
            ...
        </ul>
    </div>

```

Your expression `//div[@class='navbar-collapse collapse']/ul/li[1]` will work well against this HTML.

## Problem

However it is likely that sometime your HTML changes like this:

```auto
    <div class="collapse nav-bar-collapse">
        ...
    </div>

```

Please note the value of @class is different from the previous one. But CSS-semantically these are equivalent. Both are valid. Now you got a problem: your current expression `//div[@class='navbar-collapse collapse']/ul/li[1]` does not work against the changed HTML.

There can be even more annoying case:

```auto
    <div class="collapse nav-bar-collapse foo">
        ...
    </div>

```

How to support these cases by a single XPath expression?

## Solution

Use XPath `contains()` function and logical operator `and`, rather than `@class="alongstring"` test.

```auto
//div[contains(@class,'navbar-collapse') and contains(@class, 'collapse')]/ul/li[1]

```

---

_[View the full topic](https://forum.katalon.com/t/unable-to-click-object-despite-verifyelementclickable-returning-true/49699)._
