Comparison of lists

Hi everyone,

I’m fairly new to Robot Framework and would appreciate if someone could help me out.
Note: I’m using Automation Studio in the latest available version (2.17.2) and have the Selenium library loaded.

I want to automate the regular check of a website where several linked PDF documents are listed in a certain section of the website.


The robot is supposed to check if any of the recent PDF document links have disappeared or if there is suddenly a new PDF document listed which wasn’t there before.
Any change in the PDF link-list is supposed to be reported by Email and the detected status is to be used as reference for the next check.

This sounds pretty straightforward but I’m struggling already with a few things:

  • My static reference list of PDF links against which the current state is to be compared should be… an Excel workbook or a text file or some other format? What would be the best to save the reference list in order to loop through it?

  • Having the web-element containing the PDF link-list as a Locator, I would need to loop through the listed links with some sort of "FOR EACH ELEMENT IN DO (check against static list). However, in Automation Studio, in the list of available actions I cannot find a FOR EACH loop template other than “For each Input Work” (Control Room).
    How can I loop through the web-element container and retrieve link by link?

Any help would we really appreciated.
Thanks and kind regards

One possibility to solve your problem:

As a reference list, I recommend to use a simple .txt file with one row per list entry.

Line 1
Line 2
Line 3

Read it using the Get File Keyword and split the items into a list using Split To Lines
Now you have your expected elements as a list.

To read your text from the Web Application, first use the Get Elements
Keyword with a locator which matches to all Elements.
Then use a FOR Loop to iterate through the Elements, use Get Text to read their text content and add each item to a list. Those are your actual elements.

Last, you can compare both lists e.g. using the Lists Should Be Equal Keyword

Thank you for your tipps Many!
I will try this as you advised.

Kind regards

Hi there,

I made some progress on the named project but I’m stuck on a few things:

I wrote my links to be checked to an Excel table (only one column) and I read the worksheet as table.
I also used the Get WebElements action to get hold of the link container and I loop trough the container and retrieve the actual link with the Get Elemement Attribute (href) action. I then have a sub-loop checking if this link is contained in my list of links.

And here I get stuck because all checks fail. When I check the log at the place where the comparison is made, I see something like this:

“Link on website:
in List: {‘A’: ‘’}”

I’m assuming that the two lists are not in the same format. Do I need to convert href to a string first? Is it normal that I see a ‘A’:?

This is actually a match but the result of the comparison is incorrect:

“Link on website:
in List: {‘A’: ‘’}”

Note: this is a debug output of my two variables: one looping through the list of website links, one looping through my list of links to be checked.

Is it possible that the key A is coming from the Excel Sheet? Because the values are stored in column A or something like that?