Snehal Gokhale
Snehal Gokhale

Reputation: 11

Unable to import DateTime library in Robot Framework

I want to use keywords written in DateTime Library http://robotframework.googlecode.com/hg/doc/libraries/DateTime.html?r=2.8.5

I have robot framework 2.8.6.

Whenever I import this library in my tests in RIDE; it is shown in red (not resolved). Also in documentation I am not able to search the keywords.

Upvotes: 1

Views: 5140

Answers (3)

Yakov Gusev
Yakov Gusev

Reputation: 9

I'm use RF with Python and by default my IDE sees Python DateTime library. Use full path:

Library           robot.libraries.DateTime

Upvotes: 0

Mohorelien
Mohorelien

Reputation: 3

ombre42 is right, RIDE (my current is 1.3.0) includes an older version of RobotFramework which does not includes DateTime module. You have the RobotFramework 2.8.6 installed, but you doesn't use it when you launch tests using RobotFramework-RIDE.

Two important things:

  1. Copy DateTime.py from your RobotFramework 2.8.6 as ombre42 said, but don't import DateTime using pip: it will work but you'll not get the RobotFramework's one (which is better and documented).
  2. When you run your tests outside of RIDE, in a Jenkins environment for example, you'll probably use the RobotFramework 2.8.6 (or later) and not the same as your RIDE environment.

Upvotes: 0

ombre42
ombre42

Reputation: 2384

Your problem is probably with RIDE and not Robot Framework. RIDE uses its own copy of RF regardless of what you have installed. The included version is out of date. Try copying DateTime.py from Robot Framework installation to the folder in RIDE.

For example, copy C:\apps\Python27\Lib\site-packages\robot\libraries\DateTime.py to C:\apps\Python27\Lib\site-packages\robotide\lib\robot\libraries

Then restart RIDE.

Upvotes: 2

Related Questions