Help with Dictionary does not contain key

1,008 views
Skip to first unread message

hali4ka

unread,
Jun 26, 2012, 7:36:51 AM6/26/12
to robotframe...@googlegroups.com

Hi all,

I have a problem with a dictionary. I have one request which I am getting by executing javascript code. The request is actually key-value pair list. I convert the request result to string and I am splitting the string to key and values.
The dictionary is also filled properly as far as I can see.
This is the result of Get Dictionary Items
${items} = [u" u'arId'", u' 1000', u" u'copy'", u' False', u" u'creatorTenantDbid'"..
Get Dictionary Keys returns
@{keys} = [  u'arId' |  u'copy' |  u'creatorTenantDbid' |  u'creatorTenantName' |
Get Dictionary Values
@{values} = [  1000 |  False |  1 |  u'' |  u'Desc of demoAR' |  True |

When I call
${myID}=    Get From Dictionary    ${D1}      arId

I am getting Dictionary does not contain key arId
I have tried with 'arId' and u'arID'.
Have someone an idea why the key is not found?

Thanks in advance!






Pekka Klärck

unread,
Jun 26, 2012, 9:26:31 AM6/26/12
to hal...@googlemail.com, robotframe...@googlegroups.com
2012/6/26 hali4ka <hal...@googlemail.com>:
>
> I have a problem with a dictionary. I have one request which I am getting by
> executing javascript code. The request is actually key-value pair list. I
> convert the request result to string and I am splitting the string to key
> and values.
> The dictionary is also filled properly as far as I can see.
> This is the result of Get Dictionary Items
> ${items} = [u" u'arId'", u' 1000', u" u'copy'", u' False', u"
> u'creatorTenantDbid'"..

I'm not sure is your dictionary correctly filled. It seems to have,
for example, keys like ` u'arId'` and ` u'copy'`,, when I expect it
should have keys `arId` and `copy`. You should use `Log Dictionary` to
see what the dictionary actually contains.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org
Reply all
Reply to author
Forward
0 new messages