title: get all links and iterate through list (robot framework)
body: <p>i want to check for all items on some inbox and open them one by one until there is no more (will do some processing per item, so they dissapear after it is visited). the items are workflow based, so when it is opened they will be processed and dissapear from the inbox.</p>
  
  <p>how can i make robot make a list of these items and open them one by one? is this the right approach for such task? i'm using robotframework in eclipse w python</p>
  
  <p>the //span/a  catches all relevant links in the inbox (10)<a href="https://i.stack.imgur.com/4mrsV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4mrsV.png" alt="enter image description here"></a></p>
  
  <p>i have the following code which gets all links and puts them in a list, but i dont know what the best approach is to Open them one by one (return to inbox each time after a link was opened and some X process has been done).</p>
  
  <pre><code>Wait Until Element is Visible     xpath=//a/span
  # Count number of links on page
  ${AllLinksCount}=    Get Matching Xpath Count    xpath=//a/span
  
  # Log the count of links
  Log    ${AllLinksCount}
  
  # Create a list to store the link texts
  @{LinkItems}    Create List
  
  # Loop through all links and store links value that has length more than 1 character
  : FOR    ${INDEX}    IN RANGE    1    ${AllLinksCount}
  \    Log    ${INDEX}
  \    ${lintext}=    Get Text    xpath=(//a/span)[${INDEX}]
  \    Log    ${lintext}
  \    ${linklength}    Get Length    ${lintext}
  \    Run Keyword If    ${linklength}&gt;1    Append To List    ${LinkItems}    ${lintext}
  ${LinkSize}=    Get Length    ${LinkItems}
  Log    ${LinkSize}
  
  Comment    Print all links
  : FOR    ${ELEMENT}    IN    @{LinkItems}
  \    Log    ${ELEMENT}
  </code></pre>