# Contiue with next keyword even if previous keyword failed

**URL:** <https://forum.robotframework.org/t/contiue-with-next-keyword-even-if-previous-keyword-failed/7266>\
**Category:** Robot Framework\
**Created:** [7 May 2024 18:47 UTC](https://forum.robotframework.org/t/contiue-with-next-keyword-even-if-previous-keyword-failed/7266 "2024-05-07T18:47:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinayrana](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vinayrana](https://forum.robotframework.org/u/vinayrana)\
**Post date:** [7 May 2024 18:47 UTC](https://forum.robotframework.org/t/contiue-with-next-keyword-even-if-previous-keyword-failed/7266/1 "2024-05-07T18:47:22Z")

</div>

Hello all,

I have 2 keywords as below:

```
Wait Until Page Contains Element 'Error element' timeout= 200
Wait Until Page Does Not Contain Element 'Error element' timeout=100

```

i want the test to continue even if the error doesn’t appear on 1st keyword.

I tried below 2 options but it didnot work for me.  
option 1:

```
Run Keyword And Ignore Error Wait Until Page Contains Element 'Error element' timeout= 200       
Wait Until Page Does Not Contain Element 'Error element' timeout=100

```

option 2:

```
${Ignore_Error} Wait Until Page Contains Element 'Error element' timeout= 200
Run Keyword And Ignore Error ${Ignore_Error}
Wait Until Page Does Not Contain Element 'Error element' timeout=100

```

I have also tried Run keyword and continue on failure which didnot work for me either

Any suggestions?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Noordsestern](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/noordsestern/32/4270_2.png) [@Noordsestern](https://forum.robotframework.org/u/Noordsestern)\
**Post date:** [7 May 2024 18:59 UTC](https://forum.robotframework.org/t/contiue-with-next-keyword-even-if-previous-keyword-failed/7266/2 "2024-05-07T18:59:14Z")

</div>

Hi Vinay,

I think option 2 is not supposed to work. But option 1 should, imho. Without knowing the error message, it is impossible to guess, what did not work. But you asked for alternate suggestions.

Alternative could be:

```python
TRY
    Wait Until Page Contains Element 'Error element' timeout= 200
EXCEPT * AS ${error}
    LOG Could not find Error element due to:\t${error} WARN
    Wait Until Page Does Not Contain Element 'Error element' timeout=100
END

```

You may also try the [continue-on-failure feature](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#enabling-continue-on-failure-using-tags):

```python
***Keywords***
Contain Or Not Contain
    [Tags] robot:continue-on-failure
    Wait Until Page Contains Element 'Error element' timeout= 200
    Wait Until Page Does Not Contain Element 'Error element' timeout=100

```

Best regards,  
Markus

---

<div class="post-metadata">

**Author:** ![vinayrana](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vinayrana](https://forum.robotframework.org/u/vinayrana)\
**Post date:** [7 May 2024 19:20 UTC](https://forum.robotframework.org/t/contiue-with-next-keyword-even-if-previous-keyword-failed/7266/3 "2024-05-07T19:20:29Z")

</div>

Hey Markus,  
Thanks for the reply. i tried both alternate options you provided. they didnot work  
test case is still failing at the first keyword. I want the test to continue even if the below keyword fails

Wait Until Page Contains Element ‘Error element’ timeout= 200

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/8/83532def669cf6a7b6ce9eadeb5e337a6401b96a.png)
