在 centos 7 的机器人框架中找不到标准库模块
standard libraries modules not found in robot framework on centos 7
我在虚拟机上使用 Robot Framework 5.0.1.dev1(Python 3.6.8 on linux(centos 7 ,redhat )
我面临着与在 centos 7 上的机器人框架中找不到标准库模块相同的问题
当我使用内置库对示例机器人脚本进行正确处理时
*** Settings ***
Library OperatingSystem
Library selenium
Library BiultIn
Library Browser
Documentation A test suite with a single test for valid login.
...
... This test has a workflow that is created using keywords in
... the imported resource file.
Resource login.resource
*** KeyWords ***
$(result)
*** Test Cases ***
ValidLogin
Open Browser To Login Page
Input Username demo
Input Password mode
Submit Credentials
Welcome Page Should Be Open
[Teardown] Close Browser
MyFirstRobotTest
Log To Console Hello Robot World!
Log To Console hi
Log To Console 2+2=
MySecondRobotTest
Create File new_file.txt
Remove File new_file.txt
MyNumber
Should Be Equal $(hi) $(hi) Custom error value=True
output to is
[ WARN ] Imported library 'selenium' contains no keywords.
[ ERROR ] Error in file '/home/ashish/first.robot' on line 4: Importing library 'BiultIn' failed: ModuleNotFoundError: No module named 'BiultIn'
Traceback (most recent call last):
None
PYTHONPATH:
/usr/local/bin
/usr/lib64/python36.zip
/usr/lib64/python3.6
/usr/lib64/python3.6/lib-dynload
/home/ashish/.local/lib/python3.6/site-packages
/usr/local/lib64/python3.6/site-packages
/usr/local/lib/python3.6/site-packages
/usr/lib64/python3.6/site-packages
/usr/lib/python3.6/site-packages
[ ERROR ] Error in file '/home/ashish/first.robot' on line 5: Importing library 'Browser' failed: ModuleNotFoundError: No module named 'Browser'
Traceback (most recent call last):
None
PYTHONPATH:
/usr/local/bin
/usr/lib64/python36.zip
/usr/lib64/python3.6
/usr/lib64/python3.6/lib-dynload
/home/ashish/.local/lib/python3.6/site-packages
/usr/local/lib64/python3.6/site-packages
/usr/local/lib/python3.6/site-packages
/usr/lib64/python3.6/site-packages
/usr/lib/python3.6/site-packages
[ ERROR ] Error in file '/home/ashish/first.robot' on line 10: Resource file 'login.resource' does not exist.
==============================================================================
First :: A test suite with a single test for valid login.
==============================================================================
ValidLogin | FAIL |
No keyword with name 'Open Browser To Login Page' found.
Also teardown failed:
No keyword with name 'Close Browser' found.
------------------------------------------------------------------------------
MyFirstRobotTest Hello Robot World!
.hi
.2+2=
MyFirstRobotTest | PASS |
------------------------------------------------------------------------------
MySecondRobotTest | PASS |
------------------------------------------------------------------------------
MyNumber | PASS |
------------------------------------------------------------------------------
First :: A test suite with a single test for valid login. | FAIL |
4 tests, 3 passed, 1 failed
==============================================================================
Output: /home/ashish/output.xml
Log: /home/ashish/log.html
Report: /home/ashish/report.html
if try to install them
it shows like this
[ashish@localhost ~]$ pip install --upgrade robotframework-builtIn
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement robotframework-builtIn (from versions: none)
ERROR: No matching distribution found for robotframework-builtIn
pip list :-------------- is as follows
[ashish@localhost ~]$ pip list
Package Version
------------------------------ ----------
Appium-Python-Client 1.3.0
bcrypt 3.2.0
cffi 1.15.0
cryptography 36.0.2
decorator 5.1.1
distlib 0.3.4
docutils 0.18.1
dotdict 0.1
filelock 3.4.1
importlib-metadata 4.8.3
importlib-resources 5.4.0
kitchen 1.2.6
numpy 1.19.5
paramiko 2.10.3
pbr 5.8.1
Pillow 8.4.0
pip 21.3.1
platformdirs 2.4.0
psutil 5.9.0
pycparser 2.21
Pygments 2.11.2
PyNaCl 1.5.0
Pypubsub 4.0.3
robotframework 5.0.1.dev1
robotframework-appiumlibrary 1.6.3
robotframework-lint 1.1
robotframework-pythonlibcore 3.0.0
robotframework-ride 2.0b2.dev5
robotframework-seleniumlibrary 5.1.3
robotframework-sshlibrary 3.8.0
scp 0.14.4
selenium 3.141.0
setuptools 39.2.0
six 1.16.0
stevedore 3.5.0
typing_extensions 4.1.1
urllib3 1.26.9
virtualenv 20.14.0
virtualenv-clone 0.5.7
virtualenvwrapper 4.8.4
wheel 0.31.1
wxPython 4.0.7
zipp 3.6.0
我想不通的问题是什么......你能帮忙吗????
您的文件中有几个错误:
-
[ ERROR ] Error in file '/home/ashish/first.robot' on line 4: Importing library 'BiultIn' failed: ModuleNotFoundError: No module named 'BiultIn'
这意味着库BiultIn
不存在。如果您想使用内置库 BuiltIn
,则无需导入。
selenium
不是导入库,应该是SeleniumLibrary
,用pip install robotframework-seleniumlibrary
安装。
Browser
应该也安装了,不建议SeleniumLibrary和Browser混用
我在虚拟机上使用 Robot Framework 5.0.1.dev1(Python 3.6.8 on linux(centos 7 ,redhat )
我面临着与在 centos 7 上的机器人框架中找不到标准库模块相同的问题
当我使用内置库对示例机器人脚本进行正确处理时
*** Settings ***
Library OperatingSystem
Library selenium
Library BiultIn
Library Browser
Documentation A test suite with a single test for valid login.
...
... This test has a workflow that is created using keywords in
... the imported resource file.
Resource login.resource
*** KeyWords ***
$(result)
*** Test Cases ***
ValidLogin
Open Browser To Login Page
Input Username demo
Input Password mode
Submit Credentials
Welcome Page Should Be Open
[Teardown] Close Browser
MyFirstRobotTest
Log To Console Hello Robot World!
Log To Console hi
Log To Console 2+2=
MySecondRobotTest
Create File new_file.txt
Remove File new_file.txt
MyNumber
Should Be Equal $(hi) $(hi) Custom error value=True
output to is
[ WARN ] Imported library 'selenium' contains no keywords.
[ ERROR ] Error in file '/home/ashish/first.robot' on line 4: Importing library 'BiultIn' failed: ModuleNotFoundError: No module named 'BiultIn'
Traceback (most recent call last):
None
PYTHONPATH:
/usr/local/bin
/usr/lib64/python36.zip
/usr/lib64/python3.6
/usr/lib64/python3.6/lib-dynload
/home/ashish/.local/lib/python3.6/site-packages
/usr/local/lib64/python3.6/site-packages
/usr/local/lib/python3.6/site-packages
/usr/lib64/python3.6/site-packages
/usr/lib/python3.6/site-packages
[ ERROR ] Error in file '/home/ashish/first.robot' on line 5: Importing library 'Browser' failed: ModuleNotFoundError: No module named 'Browser'
Traceback (most recent call last):
None
PYTHONPATH:
/usr/local/bin
/usr/lib64/python36.zip
/usr/lib64/python3.6
/usr/lib64/python3.6/lib-dynload
/home/ashish/.local/lib/python3.6/site-packages
/usr/local/lib64/python3.6/site-packages
/usr/local/lib/python3.6/site-packages
/usr/lib64/python3.6/site-packages
/usr/lib/python3.6/site-packages
[ ERROR ] Error in file '/home/ashish/first.robot' on line 10: Resource file 'login.resource' does not exist.
==============================================================================
First :: A test suite with a single test for valid login.
==============================================================================
ValidLogin | FAIL |
No keyword with name 'Open Browser To Login Page' found.
Also teardown failed:
No keyword with name 'Close Browser' found.
------------------------------------------------------------------------------
MyFirstRobotTest Hello Robot World!
.hi
.2+2=
MyFirstRobotTest | PASS |
------------------------------------------------------------------------------
MySecondRobotTest | PASS |
------------------------------------------------------------------------------
MyNumber | PASS |
------------------------------------------------------------------------------
First :: A test suite with a single test for valid login. | FAIL |
4 tests, 3 passed, 1 failed
==============================================================================
Output: /home/ashish/output.xml
Log: /home/ashish/log.html
Report: /home/ashish/report.html
if try to install them
it shows like this
[ashish@localhost ~]$ pip install --upgrade robotframework-builtIn
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement robotframework-builtIn (from versions: none)
ERROR: No matching distribution found for robotframework-builtIn
pip list :-------------- is as follows
[ashish@localhost ~]$ pip list
Package Version
------------------------------ ----------
Appium-Python-Client 1.3.0
bcrypt 3.2.0
cffi 1.15.0
cryptography 36.0.2
decorator 5.1.1
distlib 0.3.4
docutils 0.18.1
dotdict 0.1
filelock 3.4.1
importlib-metadata 4.8.3
importlib-resources 5.4.0
kitchen 1.2.6
numpy 1.19.5
paramiko 2.10.3
pbr 5.8.1
Pillow 8.4.0
pip 21.3.1
platformdirs 2.4.0
psutil 5.9.0
pycparser 2.21
Pygments 2.11.2
PyNaCl 1.5.0
Pypubsub 4.0.3
robotframework 5.0.1.dev1
robotframework-appiumlibrary 1.6.3
robotframework-lint 1.1
robotframework-pythonlibcore 3.0.0
robotframework-ride 2.0b2.dev5
robotframework-seleniumlibrary 5.1.3
robotframework-sshlibrary 3.8.0
scp 0.14.4
selenium 3.141.0
setuptools 39.2.0
six 1.16.0
stevedore 3.5.0
typing_extensions 4.1.1
urllib3 1.26.9
virtualenv 20.14.0
virtualenv-clone 0.5.7
virtualenvwrapper 4.8.4
wheel 0.31.1
wxPython 4.0.7
zipp 3.6.0
我想不通的问题是什么......你能帮忙吗????
您的文件中有几个错误:
-
[ ERROR ] Error in file '/home/ashish/first.robot' on line 4: Importing library 'BiultIn' failed: ModuleNotFoundError: No module named 'BiultIn'
这意味着库
BiultIn
不存在。如果您想使用内置库BuiltIn
,则无需导入。selenium
不是导入库,应该是SeleniumLibrary
,用pip install robotframework-seleniumlibrary
安装。Browser
应该也安装了,不建议SeleniumLibrary和Browser混用