How to pass multiple list object to python keyword?

2,136 views
Skip to first unread message

JaYa

unread,
Apr 23, 2017, 11:22:57 PM4/23/17
to robotframework-users
Hi,

I have python method which accepts multiple list variable.

As  in robot framework we can pass only one list variable for user defined keyword, i would like to know is there any way to pass multiple list variable to python keywords.


Tatu Aalto

unread,
Apr 24, 2017, 1:12:39 AM4/24/17
to jaya....@gmail.com, robotframework-users
Ugh

What you want is possible, but without seeing your example it's hard to say what you are doing wrong. But the different ways of using the list variable is explained in the user guide: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#list-variables

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Bryan Oakley

unread,
Apr 24, 2017, 8:40:02 AM4/24/17
to robotframework-users
Assuming your python keyword looks like this:

    def some_keyword(list_1, list_2):
        ...

And assuming that keyword is imported, you can call it directly with the lists as arguments:

    @{list_1}=  create list   a  b  c 
    @{list_2}=  create list   1  2  3
    some keyword    ${list_1}  ${list_2}

Note that the key is to use "$" rather than "@". This behavior is documented in the user guide: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#list-variables


RANJEET SONI

unread,
Apr 26, 2017, 9:05:30 AM4/26/17
to robotframework-users
Hi,

While importing library "Collections" in Ride(Robot framework),It's getting failed. Getting below error. Can anyone pl help to resolve.
20170425 23:15:27.763 [WARN]: Importing test library "Collections" failed

Traceback (most recent call last):
Importing test library 'Collections' failed: ImportError: cannot import name is_string
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\robot\libraries\Collections.py", line 17, in <module>
    from robot.utils import (is_dict_like, is_string, is_truthy, plural_or_not,

Thanks,
Ranjeet
Reply all
Reply to author
Forward
0 new messages