Created a sample Python script( Elements.py) with a function like below:
from robot.api.deco import keyword
@keyword("join two strings")
def join_two_strings(arg1, arg2):
return arg1 + " " + arg2
Then I have imported into Robot Framework script(.robot file) as a Library:
*** Settings ***
Library AppiumLibrary
Library Selenium2Library
Library BuiltIn
#Here is the import of Custom Lib
Library Elements.py
*** Variable ***
*** Test Cases ***
Example that calls a Python keyword
${result}= join two strings hello world
Should be equal ${result} hello world
After running above the script, getting error like "No keyword with name 'join two strings' found." even though where I have imported the Custom library.
Error Message:
[ ERROR ] Error in file C:\Users\ramana.gouda\PycharmProjects\SafeMobile\Test_Suite\TestCase_346.robot: Test library 'Elements.py' does not exist.
TestCase 346 :: Creating internal cases using device
Example that calls a Python keyword | FAIL |
No keyword with name 'join two strings' found.
I always have to use relative paths unless the file is in the same directory as my test case and based on the error it looks like yours is not.
So in your case it would look something like the following (Not exactly this as I don't know where Elements.py is located):
Library ../../SafeMobile/Elements.py
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With