0

I'm just a little stuck with the Syntax and how I put up to stepsgroup adds && assertElementPresent css=span:contains('shares')

How can I edit the script to do this?

 <tr>
        <td>type</td>
        <td>id=web_user_user_id</td>
        <td>${id}</td>
    </tr>
    <tr>
        <td>pause</td>
        <td>3000</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>link=Ok</td>
        <td></td>
    </tr>
    <tr>
        <td>waitForPageToLoad</td>
        <td>10000</td>
        <td></td>
    </tr>
    <tr>
        <td>storeElementPresent</td>
        <td>link=Delete</td>
        <td>Delete</td>
    </tr>
    <tr>
        <td>storeElementPresent</td>
        <td>link=Delete</td>
        <td>Deletes</td>
    </tr>
    <tr>
        <td>while</td>
        <td>${Deletes} == true</td>
        <td></td>
    </tr>
    <tr>
        <td>echo</td>
        <td>${Deletes}</td>
        <td></td>
    </tr>
    <tr>
        <td>gotoIf</td>
        <td>${Deletes}==true</td>
        <td>Stepssingle</td>
    </tr>
    <tr>
        <td>gotoIf</td>
        <td>${Deletes}==false</td>
        <td>Stepsgroup</td>
    </tr>
    <tr>
        <td>label</td>
        <td>Stepssingle</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>link=Delete</td>
        <td></td>
    </tr>
    <tr>
        <td>echo</td>
        <td>Delete Value: ${Deletes}</td>
        <td></td>
    </tr>
    <tr>
        <td>storeElementPresent</td>
        <td>link=Delete</td>
        <td>Deletes</td>
    </tr>
    <tr>
        <td>pause</td>
        <td>10000</td>
        <td></td>
    </tr>
    <tr>
        <td>storeElementPresent</td>
        <td>link=Delete</td>
        <td>Delete</td>
    </tr>
    <tr>
        <td>label</td>
        <td>End</td>
        <td></td>
    </tr>
    <tr>
        <td>label</td>
        <td>Stepsgroup</td>
        <td></td>
    </tr>
    <tr>
        <td>assertElementPresent</td>
        <td>css=span:contains('shares')</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>link=Delete</td>
        <td></td>
    </tr>
    <tr>
        <td>pause</td>
        <td>5000</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>xpath=(//button[@type='button'])[2]</td>
        <td></td>
    </tr>
    <tr>
        <td>echo</td>
        <td>Delete Value: ${Delete}</td>
        <td></td>
    </tr>
    <tr>
        <td>storeElementPresent</td>
        <td>link=Delete</td>
        <td>Delete</td>
    </tr>
    <tr>
        <td>storeElementPresent</td>
        <td>link=Delete</td>
        <td>Deletes</td>
    </tr>
    <tr>
        <td>label</td>
        <td>End</td>
        <td></td>
    </tr>
    <tr>
        <td>endWhile</td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td>label</td>
        <td>stepscontinue</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>id=4</td>
        <td></td>
    </tr>
    <tr>
        <td>pause</td>
        <td>5000</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>link=Single</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>id=bet_order_item_attributes_bulk_id_185</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>id=bet_order_item_attributes_buy_option_bulk_buy</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>css=#bet_68 &gt; div.hide &gt; #bet_order_item_attributes_buy_option_bulk_buy</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>css=#bet_60 &gt; div.hide &gt; #bet_order_item_attributes_buy_option_bulk_buy</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>css=#bet-group &gt; div.hide &gt; #bet_order_item_attributes_buy_option_bulk_buy</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>css=i.fa.fa-arrow-right</td>
        <td></td>
    </tr>
    <tr>
        <td>type</td>
        <td>id=code</td>
        <td>new15</td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>css=#new_reduction &gt; input[name=&quot;commit&quot;]</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>link=Clear</td>
        <td></td>
    </tr>
    <tr>
        <td>pause</td>
        <td>5000</td>
        <td></td>
    </tr>
    <tr>
        <td>storeEval</td>
        <td>${i} + 1</td>
        <td>i</td>
    </tr>
    <tr>
        <td>endWhile</td>
        <td></td>
        <td></td>

closed as unclear what you're asking by Peter M. - stands for Monica, IAmMilinPatel, Chris Kenst, Bharat Mane, trashpanda May 18 '17 at 7:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Hi there. you have asked a few questions about selenium all from a similar perspective. I'm wondering if you need to go to a training site like lynda.com/Selenium-tutorials/11140-0.html, which give a 10 day free membership. (note I'm not commented with Lynda), then I think you will find answers to these questions yourself – Marcus D May 17 '17 at 13:41
  • You need to learn programming. There are plenty of free online courses. We will NOT do your homework. – Peter M. - stands for Monica May 17 '17 at 13:49
2

Replace assertElementPresent with verifyElementPresent.

The difference is basically this (taken from Selenium docs).

Choosing between “assert” and “verify” comes down to convenience and management of failures. There’s very little point checking that the first paragraph on the page is the correct one if your test has already failed when checking that the browser is displaying the expected page. If you’re not on the correct page, you’ll probably want to abort your test case so that you can investigate the cause and fix the issue(s) promptly. On the other hand, you may want to check many attributes of a page without aborting the test case on the first failure as this will allow you to review all failures on the page and take the appropriate action. Effectively an “assert” will fail the test and abort the current test case, whereas a “verify” will fail the test and continue to run the test case.

For making a step optional, you need conditional logic. You'll need javascript and/or Selenium extensions, refer to the answers in this StackOverflow thread.

  • I tried to change to verifyElementPresent, but it still check me for the stepsgroup. The test is that once the word "shares" does not appear I do not want it to perform the stepsgroup test. Follow I'm stuck and breaking my head – user25686 May 17 '17 at 15:17
  • You need to put it in an if statement so the verify check will trigger which way it goes on steps. – mutt May 17 '17 at 18:41
  • @user25686 edited answer with a link that might help you out, I think – FDM May 18 '17 at 5:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.