My defined class in Python:
class jpg(Abc):
def __init__(self, *args, **kwargs):
super(jpg, self).__init__(**kwargs)
self.TAG = 'tag'
self.PARAMS = {}
I import this class in Robot framework:
Import Library jpg host=${ip} WITH NAME jpg
How can I call PARAMS in Robot Framework?
I tried with ${jpg.PARAMS} or jpg.${PARAMS}, but it didn't work
I want to do 2 actions on this variable: set and get
You can create a new python keyword to use the class.
It may like this:
class_test.py
class jpg(object):
def __init__(self, *args, **kwargs):
self.TAG = 'hello tag'
self.args = args
self.PARAMS = {}
def test_jpg(*args, **kwargs):
return jpg(*args, **kwargs)
Then, you can use it in your robot files like this:
test.robot
*** Settings ***
Library class_test.py
*** Test Cases ***
python class test
[Tags] class
[Documentation] python class test
${ret}= test_jpg class_tag
Log ${ret.TAG}
Log ${ret.args}
log file like below:

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