# Problem using wait for element clickable instead of WebUI.Delay

**URL:** <https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [June 14, 2019, 10:39am UTC](https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811 "2019-06-14T10:39:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bernardo.pinto](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bernardo.pinto](https://forum.katalon.com/u/bernardo.pinto)\
**Post date:** [June 14, 2019, 10:39am UTC](https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811/1 "2019-06-14T10:39:03Z")

</div>

Unfortunately the katalon script i made is not working as I wished. Basically, I can not click a button even with the wait for element clickable function before click. However when putting a delay in the script it runs successfully. Why does it happen? I really don´t understand. Because the test passed on wait for element clickable but failed when i perfom the click. It only works with delay and i don’t want to use it because i want to have a dynamic time and not a static one. This really compromise performance of my test scripts.

---

<div class="post-metadata">

**Author:** ![Timo\_Kuisma](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@Timo\_Kuisma](https://forum.katalon.com/u/Timo_Kuisma)\
**Post date:** [June 14, 2019, 7:52pm UTC](https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811/2 "2019-06-14T19:52:38Z")

</div>

hi,

try some another wait method  
e.g. waitForElementPresent

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 14, 2019, 8:09pm UTC](https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811/3 "2019-06-14T20:09:37Z")

</div>

> [@bernardo.pinto](#):
>
> It only works with delay and i don’t want to use it because i want to have a dynamic time and not a static one. This really compromise performance of my test scripts.

I agree and it’s a well-known problem. While I don’t have a specific answer, I can explain how you can work toward a better solution.

First, the problem in general terms:

1. Your test runs like lightning.
2. The browser takes a long time to “build” the webpage – all the controls, buttons, and other elements take time to create, position and lay them out, etc.
3. You need to introduce a means to _synchronize_ your fast test script with a slow browser.

In terms of delays, fixed or otherwise, _every line of test code_ slows your test a little. ← That’s your clue, right there.

If you adopt a philosophy of waiting for lots of things (even things that don’t seem to matter much) you will be adding to the overall time it takes to hit your real test case statements.

So start writing more “waits”. Perhaps you can wait for a menu to be visible and wait for a copyright message (usually at the end of a page, which is good). And Like Timo suggested, use all the waits on each of the “don’t really care about these” elements:

1. Wait for element _present_.
2. Wait for element _visible_

Do that for _each_ element _before_ you get to the element you’re trying to test. Then, just for insurance purposes,

1. `WebUI.delay(1)` or whatever delay you think necessary.

Now you’re ready to target the elements you _really_ care about.

**“But wait – isn’t that adding a lot of code to each test?"**

Depends how you do it. You can write custom keywords to minimize the amount of code:

```javascript
waitForElementReallyReallyReallyReady(findTestObject("copyright_message"),10)

```

```javascript
void waitForElementReallyReallyReallyReady(TestObject to, int delay) {
  WebUI.waitForElementPresent(to, delay)
  WebUI.waitForElementVisible(to, delay)
}

```

Hope that helps you. Works for me all day every day.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 16, 2019, 9:29pm UTC](https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811/4 "2019-06-16T21:29:06Z")

</div>

What’s likely happening is that the button IS clickable based on what katalon (and to the underlying webdriver) define as “clickable”. I believe that webdriver considers element visibility, as well as the state of the `disabled` attribute when checking for clickability. My guess as to what’s happening is that there’s some other attribute that you will need to check for outside of these two things to know when the button is truly ready to receive a click.

To start, can you share the HTML for the button and maybe some if it’s parent elements?

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:43am UTC](https://forum.katalon.com/t/problem-using-wait-for-element-clickable-instead-of-webui-delay/27811/5 "2022-08-08T07:43:50Z")

</div>

Archived on August 8, 2022, 7:43am UTC


