How to change the selector every time when the loop is executed?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















In my below script, I want to change the value of the variable $drop_down_items every time when the loop is executed.



div.col:nth-child(**2**) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div


In the above locator I want to increment the nth-child value from 2 to 3, 3 to 4 and so on every time when the loop is executed.



*** Variables ***
$combo_boxes css=div.col > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1)
$drop_down_items css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
*** Keywords ***
Loop
@combo_boxes= Get WebElements $combo_boxes
:FOR $each IN @combo_boxes
Click Element $each
Loop A
Sleep 0.5s
Click Element $each

Loop A
@get_role_list= Get WebElements css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
:FOR $each IN @get_role_list
Sleep 0.5s
Click Element $each
Sleep 0.5s
Run Keyword If '$each'!='EXIT' Click Element $combo_boxes









share|improve this question
























  • Is this the HTML code of a public site?

    – A. Kootstra
    Nov 15 '18 at 13:46

















0















In my below script, I want to change the value of the variable $drop_down_items every time when the loop is executed.



div.col:nth-child(**2**) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div


In the above locator I want to increment the nth-child value from 2 to 3, 3 to 4 and so on every time when the loop is executed.



*** Variables ***
$combo_boxes css=div.col > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1)
$drop_down_items css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
*** Keywords ***
Loop
@combo_boxes= Get WebElements $combo_boxes
:FOR $each IN @combo_boxes
Click Element $each
Loop A
Sleep 0.5s
Click Element $each

Loop A
@get_role_list= Get WebElements css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
:FOR $each IN @get_role_list
Sleep 0.5s
Click Element $each
Sleep 0.5s
Run Keyword If '$each'!='EXIT' Click Element $combo_boxes









share|improve this question
























  • Is this the HTML code of a public site?

    – A. Kootstra
    Nov 15 '18 at 13:46













0












0








0








In my below script, I want to change the value of the variable $drop_down_items every time when the loop is executed.



div.col:nth-child(**2**) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div


In the above locator I want to increment the nth-child value from 2 to 3, 3 to 4 and so on every time when the loop is executed.



*** Variables ***
$combo_boxes css=div.col > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1)
$drop_down_items css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
*** Keywords ***
Loop
@combo_boxes= Get WebElements $combo_boxes
:FOR $each IN @combo_boxes
Click Element $each
Loop A
Sleep 0.5s
Click Element $each

Loop A
@get_role_list= Get WebElements css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
:FOR $each IN @get_role_list
Sleep 0.5s
Click Element $each
Sleep 0.5s
Run Keyword If '$each'!='EXIT' Click Element $combo_boxes









share|improve this question
















In my below script, I want to change the value of the variable $drop_down_items every time when the loop is executed.



div.col:nth-child(**2**) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div


In the above locator I want to increment the nth-child value from 2 to 3, 3 to 4 and so on every time when the loop is executed.



*** Variables ***
$combo_boxes css=div.col > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1)
$drop_down_items css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
*** Keywords ***
Loop
@combo_boxes= Get WebElements $combo_boxes
:FOR $each IN @combo_boxes
Click Element $each
Loop A
Sleep 0.5s
Click Element $each

Loop A
@get_role_list= Get WebElements css=div.col:nth-child(2) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
:FOR $each IN @get_role_list
Sleep 0.5s
Click Element $each
Sleep 0.5s
Run Keyword If '$each'!='EXIT' Click Element $combo_boxes






robotframework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 21:28









Bence Kaulics

3,23272243




3,23272243










asked Nov 15 '18 at 11:22









PoovinPoovin

496




496












  • Is this the HTML code of a public site?

    – A. Kootstra
    Nov 15 '18 at 13:46

















  • Is this the HTML code of a public site?

    – A. Kootstra
    Nov 15 '18 at 13:46
















Is this the HTML code of a public site?

– A. Kootstra
Nov 15 '18 at 13:46





Is this the HTML code of a public site?

– A. Kootstra
Nov 15 '18 at 13:46












2 Answers
2






active

oldest

votes


















0














Loop
@combo_boxes= Get WebElements $combo_boxes
$INTEGER = Set Variable 2
Set Suite Variable $INTEGER_A $INTEGER
:FOR $each IN @combo_boxes
Click Element $each
$roles_list= Set Variable css=.list > div:nth-child($INTEGER_A) >
div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
Loop A $roles_list $each
$INTEGER_A= Evaluate $INTEGER_A + 1
Sleep 0.5s
Click Element $each


Loop A
[Arguments] $roles_list $combo
@get_role_list= Get WebElements $roles_list
:FOR $each IN @get_role_list
Click Element "$each"
Run Keyword If '$each'!='EXIT' Click Element $combo





share|improve this answer






























    0














    The solution is to add another loop layer. In the Robot Framework Guide there is a section on the different looping functionality that Robot Framework offers. In particular have a loop at the For-in-range section. This is an example that should help with your problem.



    *** Test Cases ***
    Only upper limit
    [Documentation] Loops over values from 0 to 9
    :FOR $index IN RANGE 10
    Log $index





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318382%2fhow-to-change-the-selector-every-time-when-the-loop-is-executed%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Loop
      @combo_boxes= Get WebElements $combo_boxes
      $INTEGER = Set Variable 2
      Set Suite Variable $INTEGER_A $INTEGER
      :FOR $each IN @combo_boxes
      Click Element $each
      $roles_list= Set Variable css=.list > div:nth-child($INTEGER_A) >
      div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
      Loop A $roles_list $each
      $INTEGER_A= Evaluate $INTEGER_A + 1
      Sleep 0.5s
      Click Element $each


      Loop A
      [Arguments] $roles_list $combo
      @get_role_list= Get WebElements $roles_list
      :FOR $each IN @get_role_list
      Click Element "$each"
      Run Keyword If '$each'!='EXIT' Click Element $combo





      share|improve this answer



























        0














        Loop
        @combo_boxes= Get WebElements $combo_boxes
        $INTEGER = Set Variable 2
        Set Suite Variable $INTEGER_A $INTEGER
        :FOR $each IN @combo_boxes
        Click Element $each
        $roles_list= Set Variable css=.list > div:nth-child($INTEGER_A) >
        div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
        Loop A $roles_list $each
        $INTEGER_A= Evaluate $INTEGER_A + 1
        Sleep 0.5s
        Click Element $each


        Loop A
        [Arguments] $roles_list $combo
        @get_role_list= Get WebElements $roles_list
        :FOR $each IN @get_role_list
        Click Element "$each"
        Run Keyword If '$each'!='EXIT' Click Element $combo





        share|improve this answer

























          0












          0








          0







          Loop
          @combo_boxes= Get WebElements $combo_boxes
          $INTEGER = Set Variable 2
          Set Suite Variable $INTEGER_A $INTEGER
          :FOR $each IN @combo_boxes
          Click Element $each
          $roles_list= Set Variable css=.list > div:nth-child($INTEGER_A) >
          div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
          Loop A $roles_list $each
          $INTEGER_A= Evaluate $INTEGER_A + 1
          Sleep 0.5s
          Click Element $each


          Loop A
          [Arguments] $roles_list $combo
          @get_role_list= Get WebElements $roles_list
          :FOR $each IN @get_role_list
          Click Element "$each"
          Run Keyword If '$each'!='EXIT' Click Element $combo





          share|improve this answer













          Loop
          @combo_boxes= Get WebElements $combo_boxes
          $INTEGER = Set Variable 2
          Set Suite Variable $INTEGER_A $INTEGER
          :FOR $each IN @combo_boxes
          Click Element $each
          $roles_list= Set Variable css=.list > div:nth-child($INTEGER_A) >
          div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > combo-box:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div
          Loop A $roles_list $each
          $INTEGER_A= Evaluate $INTEGER_A + 1
          Sleep 0.5s
          Click Element $each


          Loop A
          [Arguments] $roles_list $combo
          @get_role_list= Get WebElements $roles_list
          :FOR $each IN @get_role_list
          Click Element "$each"
          Run Keyword If '$each'!='EXIT' Click Element $combo






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 10:50









          VenkateshVenkatesh

          375




          375























              0














              The solution is to add another loop layer. In the Robot Framework Guide there is a section on the different looping functionality that Robot Framework offers. In particular have a loop at the For-in-range section. This is an example that should help with your problem.



              *** Test Cases ***
              Only upper limit
              [Documentation] Loops over values from 0 to 9
              :FOR $index IN RANGE 10
              Log $index





              share|improve this answer



























                0














                The solution is to add another loop layer. In the Robot Framework Guide there is a section on the different looping functionality that Robot Framework offers. In particular have a loop at the For-in-range section. This is an example that should help with your problem.



                *** Test Cases ***
                Only upper limit
                [Documentation] Loops over values from 0 to 9
                :FOR $index IN RANGE 10
                Log $index





                share|improve this answer

























                  0












                  0








                  0







                  The solution is to add another loop layer. In the Robot Framework Guide there is a section on the different looping functionality that Robot Framework offers. In particular have a loop at the For-in-range section. This is an example that should help with your problem.



                  *** Test Cases ***
                  Only upper limit
                  [Documentation] Loops over values from 0 to 9
                  :FOR $index IN RANGE 10
                  Log $index





                  share|improve this answer













                  The solution is to add another loop layer. In the Robot Framework Guide there is a section on the different looping functionality that Robot Framework offers. In particular have a loop at the For-in-range section. This is an example that should help with your problem.



                  *** Test Cases ***
                  Only upper limit
                  [Documentation] Loops over values from 0 to 9
                  :FOR $index IN RANGE 10
                  Log $index






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 '18 at 13:49









                  A. KootstraA. Kootstra

                  4,61721233




                  4,61721233



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318382%2fhow-to-change-the-selector-every-time-when-the-loop-is-executed%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Use pre created SQLite database for Android project in kotlin

                      Darth Vader #20

                      Ondo