"导入测试库' Selenium2Library'失败:ImportError:没有名为decorator的模块" RobotFramework maven插件

时间:2016-11-15 23:43:31

标签: java python maven intellij-idea robotframework

尝试使用RobotFramework-Maven-Plugin 1.4.6在OS X El Capitan 10.11.6上的IntelliJ 2016.2中的Maven Java项目中运行简单测试

http://robotframework.org/MavenPlugin/

如果使用机器人通过命令行运行测试,测试将打开一个firefox浏览器,运行并传递:

...
window['lbd'] = {
    misc:{
        navbar_menu_visible: 0
    },
...

这是我收到的错误:

*** Settings ***
Library  Selenium2Library
Suite Teardown  Close all browsers

*** Variables ***
${BROWSER}  firefox
${DOMAIN}  google.com
${PAGE_TITLE}  google

*** Test Cases ***
Example
  Open browser  http://${DOMAIN}  ${BROWSER}
  Page Should Contain  ${PAGE_TITLE}

这是我的pom.xml的重要部分:

Importing test library 'Selenium2Library' failed: ImportError: No module named decorator

我在RobotFramework Maven插件网站规定的/ src / test / resources / robotframework / libraries /下有最新的Selenium2Library 1.8.0:http://robotframework.org/MavenPlugin/examples/seleniumlibrary.html

我整天都在解决这个问题并且已经搜索过并最终走到了尽头。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

我弄清楚我做错了什么,我还没有进行测试,但我已经过了这个问题。基本上,如果您使用RobotFramework Selenium2Library Java端口,则不再需要按照网站上的说明关于在/ src / test / resources / robotframework / libaries下使用Selenium2Library

您不需要在您的资源目录中拥有Selenium2Library,它由maven依赖项处理。