Excluding keywords from imported library


I recently started exploring robotframework FlaUI library as it could be better tool for our test automation.
However, our infrastructure supports many projects which can use different tools - meaning, even if our project switches to FlaUI, other project can be using other tools.
The infrastructure uses ScreenCapLibrary for taking screenshots in many points of tests, but it happens that the FlaUI library has a keyword with the same name “Take Screenshot”.
Specifying the resource with every “Take Screenshot” in the *.robot using FlaUILibrary is something I would like to avoid.

Is there a way to import the FlaUI (or any other) library without the one specific keyword?

I already tried:
Library FlaUILibrary exclude=Take Screenshot

And running a dummy test case with “Take Screenshot” only, but the keyword was still executable.

Thanks in advance for any advices.

Hi David,

I’m not aware of any way to exclude a keyword, but there’s not really a need for it, see Handling keywords with same names for the details.

Basically you can determine which keyword takes precedence by controlling the order you import the libraries.

Also if you want to ensure you always use the keyword form a specific library you can use the LibraryName.Keyword Name method (FlaUILibrary.Take Screenshot or ScreenCapLibrary.Take Screenshot as you need)

So in your situation I’d try to ensure that ScreenCapLibrary takes precedence for the other test cases and then use FlaUILibrary.Take Screenshot as you need to.


Hi Dave,

Thank you very very much. That’s exactly what I was looking for but without success.

It’s great that the provided keyword works on suite level and does not fail when an unimported library is listed in arguments.

Again, thanks a lot, and have a nice day

1 Like