# How to combine Wait Until Element Is Visible and Element Should Be Visible

**URL:** <https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761>\
**Category:** Robot Framework\
**Created:** [10 April 2025 04:48 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761 "2025-04-10T04:48:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alice88](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/alice88/32/4724_2.png) [@alice88](https://forum.robotframework.org/u/alice88)\
**Post date:** [10 April 2025 04:48 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/1 "2025-04-10T04:48:58Z")

</div>

Hi everyone,  
I’m studing RobotFramework. I have some problem in Wait Until Element Is Visible and Element Should Be Visible. If i use Element Should Be Visible ,it would be correct in the context i need to assert the visible element but it doesn’t have wait,fails Immediately. If i just Wait Until Element Is Visible , it’s okay but it is out of context assert.  
So i think i combine with Wait Until Element Is Visible. Ex:  
Wait And Assert Element Visible  
Wait Until Element Is Visible ${ELEMENT} timeout=${TIMEOUT}  
Element Should Be Visible ${ELEMENT}

But I find this way not optimal because if the element is not visible, it will not continue to Element Should Be Visible. So anyone help me to combine most effectively?  
Thanks so much

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [10 April 2025 06:23 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/2 "2025-04-10T06:23:26Z")

</div>

Hi,

Thing is that if your Wait fails, it means the element is not visible, then obviously the Element Should be Visible will fail too. So the first kwd already give you the state of the element?  
I don’t understand why you need the code to run to the second kwd?

Anyway, you could either wrap the first one with a Run Keyword And Continue On Failure to access the second kwd:

```
Run Keyword And Continue On Failure Wait Until Element Is Visible ${ELEMENT} timeout=${TIMEOUT}
Element Should Be Visible ${ELEMENT}

```

Or use a Try Except:

```
TRY
    Wait Until Element Is Visible ${ELEMENT} timeout=${TIMEOUT}
EXCEPT
    Element Should Be Visible ${ELEMENT}
END

```

Then wrap second kwd with Run Keyword And Warn On Failure to avoid test fail.

Regards  
Charlie

---

<div class="post-metadata">

**Author:** ![alice88](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/alice88/32/4724_2.png) [@alice88](https://forum.robotframework.org/u/alice88)\
**Post date:** [10 April 2025 07:16 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/3 "2025-04-10T07:16:35Z")

</div>

Hi Charlie, thanks for support , My mean if we use the first keyword Wait Until Element Is Visible it will not be correct in the context of assert. i think it is wait. So i want to add Element Should Be Visible for the purpose assert element.but the problem is as you said : element is not visible, then obviously the Element Should be Visible will fail too  
I want to find a way to combine these 2 keywords, first wait for the element to be visible, and then check if it is visible or not

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [10 April 2025 16:26 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/4 "2025-04-10T16:26:18Z")

</div>

Well, maybe something like this then:

```
${result} Run Keyword And Return Status Wait Until Element Is Visible ${ELEMENT} timeout=5
IF ${result}
    Element Should Be Visible ${ELEMENT}
ELSE
     Fail Element was not visible after waiting
END

```

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [10 April 2025 17:03 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/5 "2025-04-10T17:03:02Z")

</div>

Hey Charile - Could be wrong, but I didn’t think you could chain those two keywords together, as Run Keyword And Return Status doesn’t capture timeouts. So it would still possibly need wrapping in a try-except , at which point that return status keyword is redundant and the except would handle it. So the original try/except is probably best fitted for error handling here, as you suggested first. Happy to be wrong though:slight\_smile:

…No idea what library is being used here; Wait Until Element Is Visible exists in a couple of libraries.

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [10 April 2025 19:12 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/6 "2025-04-10T19:12:07Z")

</div>

> [@\_daryl](#):
>
> Run Keyword And Return Status doesn’t capture timeouts

Oh yes you’re right 😅 never tried it though.  
But I agree on the redundant check, and honestly thought about Seleniumlibrary at first.

---

<div class="post-metadata">

**Author:** ![alice88](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/alice88/32/4724_2.png) [@alice88](https://forum.robotframework.org/u/alice88)\
**Post date:** [11 April 2025 05:03 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/7 "2025-04-11T05:03:02Z")

</div>

> [@CharlieScene](#):
>
> ```python
> Run Keyword And Continue On Failure Wait Until Element Is Visible ${ELEMENT} timeout=${TIMEOUT}
> Element Should Be Visible ${ELEMENT}
> 
> ```

I think it is the better way, Charlie

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [11 April 2025 08:49 UTC](https://forum.robotframework.org/t/how-to-combine-wait-until-element-is-visible-and-element-should-be-visible/8761/8 "2025-04-11T08:49:03Z")

</div>

Based on the built-in documentation for Run Keyword And Continue On Failure:

> The execution is not continued if the failure is caused by invalid syntax, timeout, or fatal exception.

I’d still opt for a TRY/EXCEPT for error handling in this case. But as Charlie mentions Ive never tried paring the "Run Keyword And… " to see how it handles a keyword that can timeout as well, but if the docs are correct then it will throw an error as opposed to continue given it mentions not handling timeouts
