0

I have been looking around but cant seem to find a solution.

I want to do the following:

Assert/Verify an element is present If the element is present go to label.

i have tried:

    <tr>
        <td>verifyElementPresent</td>
        <td>css=#error_div &gt; div.content</td>
        <td>errorPresent</td>
    </tr>
    <tr>
        <td>gotoIf</td>
        <td>&quot;${errorPresent}&quot; == &quot;true&quot;</td>
        <td>FAIL</td>
    </tr>
.. BLa bla some other steps
    <tr>
        <td>label</td>
        <td>FAIL</td>
        <td></td>
    </tr>

I have tried changing if to assert element but no luck.

Any suggestions?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Anders Gerner
  • 775
  • 9
  • 27

2 Answers2

5

This should work:

<tr>
    <td>storeElementPresent</td>
    <td>css=#error_div > div.content</td>
    <td>isPresent</td>
</tr>
<tr>
    <td>gotoIf</td>
    <td>storedVars.isPresent</td>
    <td>FAIL</td>
</tr>
.. BLa bla some other steps
<tr>
    <td>label</td>
    <td>FAIL</td>
    <td></td>
</tr>
Michael Blank
  • 344
  • 1
  • 2
0

I struggled with this for a little while. this is the code that worked for me Anything in bold you can replace with your item of choice

<tr>
    <td>storeElementPresent</td>
    <td>WHAT YOU ARE LOOKING FOR</td>
    <td>isPresent</td>
</tr>
<tr>
    <td>gotoIf</td>
    <td>${isPresent} == false</td>
    <td>FAIL</td>
</tr>
THE CODE YOU WISH TO EXICUTE IF IT FINDS WHAT YOU ARE LOOKING FOR
<tr>
    <td>label</td>
    <td>FAIL</td>
    <td></td>
</tr>

You can replace false with true if you wish to look for something is there. You can also change the label from FAIL to any other text.

In the event you have more than one gotoIf statement then you will have to change your label for each statement (eg. FAIL, FAIL1, FAIL2, etc)

Credit to Yeven Ulyanenkov over in this thread

In order to run gotoIf statements you need to download sideflow by Darren DeRidder

Github - sideflow

Community
  • 1
  • 1
Brainles71
  • 77
  • 13