Unable to use Selenium2Library in Robot Framework. ImportError: No module named Selenium2Library error
Unable to use Selenium2Library in Robot Framework. ImportError: No module named Selenium2Library error
我无法在 Robot Framework 中使用 Selenium2Library。它抛出以下错误:
C:\RFW>jybot.bat SW_Installation.robot
[ ERROR ] Error in file 'C:\RFW\SW_Installation.robot': Importing test library '
Selenium2Library' failed: ImportError: No module named Selenium2Library
Traceback (most recent call last):
None
PYTHONPATH:
C:\RFW\SWInstall.sikuli
C:\RFW\robot\libraries
C:\RFW
C:\RFW\sikulixapi.jar\Lib
C:\RFW\Lib
C:\RFW\jython-standalone-2.7-b3.jar\Lib
__classpath__
__pyclasspath__/
.
CLASSPATH:
C:\RFW\jython-standalone-2.7-b3.jar
C:\RFW\sikulixapi.jar
我的机器人文件是:
***Settings***
Library Selenium2Library
Library Install.Installation WITH NAME Installation
*** Variables ***
${NONE} none
***Test Cases***
testcase1
ClickInstallBatFile
sleep 90
Click Button 885,523
我尝试在 python 交互式 shell 中导入库。它按预期工作,如下所示:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\test>python
ActivePython 2.7.8.10 (ActiveState Software Inc.) based on
Python 2.7.8 (default, Jul 2 2014, 19:50:44) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Selenium2Library
>>> import SeleniumLibrary
>>>
谁能给点线索吗?
谢谢,
库马尔
对于简单的 Java 解决方案,请查看 here。
根据我的记忆,如果您将所有必需的 jar 添加到您的类路径中,它就会起作用。但是我已经把我的jython去掉了,所以我无法验证。
无论如何,我建议使用 pybot 而不是 jybot。
您似乎已经为 python 安装了 Selenium2Library,但您正在使用 jython(通过 jybot)来 运行 您的测试。
你至少有三种解法:
切换到pybot。您仍然可以通过 jrobotremoteserver
使用基于 java 的关键字
用jython安装。有关详细信息,请参阅此问题:Can I install Selenium2Library for RobotFramework without installing Python?
使用port of Selenium2Library到java。
我无法在 Robot Framework 中使用 Selenium2Library。它抛出以下错误:
C:\RFW>jybot.bat SW_Installation.robot
[ ERROR ] Error in file 'C:\RFW\SW_Installation.robot': Importing test library '
Selenium2Library' failed: ImportError: No module named Selenium2Library
Traceback (most recent call last):
None
PYTHONPATH:
C:\RFW\SWInstall.sikuli
C:\RFW\robot\libraries
C:\RFW
C:\RFW\sikulixapi.jar\Lib
C:\RFW\Lib
C:\RFW\jython-standalone-2.7-b3.jar\Lib
__classpath__
__pyclasspath__/
.
CLASSPATH:
C:\RFW\jython-standalone-2.7-b3.jar
C:\RFW\sikulixapi.jar
我的机器人文件是:
***Settings***
Library Selenium2Library
Library Install.Installation WITH NAME Installation
*** Variables ***
${NONE} none
***Test Cases***
testcase1
ClickInstallBatFile
sleep 90
Click Button 885,523
我尝试在 python 交互式 shell 中导入库。它按预期工作,如下所示:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\test>python
ActivePython 2.7.8.10 (ActiveState Software Inc.) based on
Python 2.7.8 (default, Jul 2 2014, 19:50:44) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Selenium2Library
>>> import SeleniumLibrary
>>>
谁能给点线索吗?
谢谢, 库马尔
对于简单的 Java 解决方案,请查看 here。
根据我的记忆,如果您将所有必需的 jar 添加到您的类路径中,它就会起作用。但是我已经把我的jython去掉了,所以我无法验证。
无论如何,我建议使用 pybot 而不是 jybot。
您似乎已经为 python 安装了 Selenium2Library,但您正在使用 jython(通过 jybot)来 运行 您的测试。
你至少有三种解法:
切换到pybot。您仍然可以通过 jrobotremoteserver
使用基于 java 的关键字
用jython安装。有关详细信息,请参阅此问题:Can I install Selenium2Library for RobotFramework without installing Python?
使用port of Selenium2Library到java。