Robotframework dictionary problem for help

  • I created 2 dic through rf and python.
  • And i want to get dic’value by ${dic.key}
  • the dic created with rf is ok
  • the dic created with python is error

I have been puzzled with this puzzling problem for a long time…

Please help me,thanks

Hi,

Python dict() can only be accessed like ${dict}[key]

RobotFramework dicts are of the type DotDict() and can also be accessed with dots.

You can convert a python dict() with the BuiltIn Keyword Create Dictionary

http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Create%20Dictionary

${dotdict}    Create Dictionary    ${pydict}
2 Likes

Oh, thank you , my dai lo :kissing_heart:

Hello, dai lo
Is there some extension tools for RF to format code.
My IDE is pycharm.

This Language Server can do it.
It uses tidy wich is a Robot Framework built in tool.

When LSP is running, you can do Code -> Reformat File

Thanks for your sharing very much.
But i am sorry, i can’t fully understand how to configure at step 4.
Is my screenshot right?

Please read the full thread there is written what to do on step 4.

You have to enter the path to the robotframework-ls executable

Hi, I am trying to extract keywords from resources into my test case, but it is showing import file not found. hw can i solve this issue.


My Resource folder file contains all the necessary keywords. As below.
*** Settings ***

Library SeleniumLibrary
Variables …/PageObjects/Toolspageobjects.py

*** Keywords ***

Open Tools Login Page
[Arguments] {ToolsURL} {Browser}
open browser {ToolsURL} {Browser}
maximize browser window

And my python file contains the necessary variables, that are stored to get the relative path of the browser.

Tools login Page Elements

company_name = “name:txtCompanyName”
user_name = “name:txtUserName”
password = “name:txtPassword”
sign_in = “name:ibtnLoginBottom”

I dont know what to do, tried multiple things, nothing gave most concrete solution.

Hi @logida,

Please open a new thread for your question next time.

As for your question: in caae you don’t do any tricks with your pythonpath, I think the path to the resource file is wrong. It should be ../../Resource/ToolsKeyword.robot

Regards