JAYY
JAYY

Reputation: 470

Looping XPath variables in robot framework keywords

newbie to the robot framework. I am trying to have a for loop within the keywords.

Currently the issue now is that it is not looping and going straight to 9. Not looping from 1..2...9.

Would appreciate if someone can take a look at it.

Upvotes: 0

Views: 1840

Answers (1)

Dev
Dev

Reputation: 2813

It seems forgot to use range function you can do like-

 FOR    ${INDEX}    IN RANGE    1   ${MAX+1}

    click element   xpath:/html/body/main/div/div/div/div[${INDEX}]/a
 END

Reference - new style of for loop in RF 3.1 release

Upvotes: 3

Related Questions