Search code examples
automationselenium-ide

Selenium check for gotoif when statement is false


I had written a Selenium command via IDE by implementing gotoIf when the statement is true it jumps to the label but while the statement if false it is not going to the desired label

I have attached the command and log as well

enter image description here


Solution

  • You just need to make sure the code you want to execute if "home" is found is inside your gotoIf statement. It should look like below

    gotoIf | ${test}==true | A
    click | css=a.aits-log-out
    label | A
    

    Remove label | B as your gotoIf statement isn't looking for that label because you haven't defined it.

    Code to copy paste if you want that as well

    <tr>
        <td>gotoIf</td>
        <td>${test} == true</td>
        <td>A</td>
    </tr>
    <tr>
        <td>click</td>
        <td>css=a.aits-log-out</td>
        <td></td>
    </tr>
    <tr>
        <td>label</td>
        <td>A</td>
        <td></td>
    </tr>