Can I use importes Resources by name? How do you do it?

Hi, I’m new to Robot Framework and I enjoy it, but I’m having a hard time with this.

For each page I have a resource file e. g. home.resource with my locators, variables and keywords. In my Tests I might be importing multiple resources and I want to be able to do something like: login.${url}. You can do something like that with libraries but not with resources and I’m having a hard time keeping everything clean and easy to understand.

My current solution is to name my variables with a prefix e. g. ${HOME.URL}, ** but there must be a better way, no? How do you guys deal with this?

P.S. I was also trying to use yaml files with dictionaries but sometimes I need my variables to be dynamic so that’s not a solution.

P.P.S. I was also thinking about using dictionaries in the resource file but the key value pairs are not tabular which doesn’t look very clean
e. g.
&{login} url=/login title=h1

Hi @nippsh,

You import resource files with the Resource keyword just like Libraries are imported with the Library keyword.

I previously gave a demonstration of resource files with a working example in this forum post:

Hope that helps,