Reputation: 1
I have two objects in robot file created like this.
Library HwTest COM17 SN2 WITH NAME Smart Node 2
Library HwTest COM13 SN1 WITH NAME Smart Node 1
I need to pass Smart Node 1 and Smart Node 2 in a user defined keyword.
But when I gave the object name after the keyword it was taken as a unicode in python,not as a object. I get error like unicode object has no attribute. AttributeError: 'unicode' object has no attribute 'filename'
Upvotes: 0
Views: 1373
Reputation: 385970
There's not enough detail in your question, but I'm going to make an educated guess that you have a keyword that requires you pass in an object, but you're passing the library name to it, like this:
The keyword Smart Node 2
If so, that's not how to use keyword libraries in robot. "Smart Node 2" is just the name of the library, not the library itself. If you're trying to use the library as an object then you need to get the instance of that library before passing it to the keyword.
Robot has a built-in keyword named Get library instance which can return the instance of the library. You will need to call that to get the instance, and then pass the instance to your keyword.
Example:
${object}= Get library instance Smart Node 2
The keyword ${object}
Upvotes: 2