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;
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
add a comment |
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
Is this the HTML code of a public site?
– A. Kootstra
Nov 15 '18 at 13:46
add a comment |
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
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
robotframework
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Nov 16 '18 at 10:50
VenkateshVenkatesh
375
375
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Nov 15 '18 at 13:49
A. KootstraA. Kootstra
4,61721233
4,61721233
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Is this the HTML code of a public site?
– A. Kootstra
Nov 15 '18 at 13:46