win7上用robotframe只能使用python2版本,不可使用python3版。命令行啓動robot時,注意代表啓動的python版本號(本機有兩個python版本時)html
安裝完成之後在Python安裝目錄下的Scripts目錄下執行以下命令就能夠啓動RIDE了python
python2 ride.py
|
注意:本機共存兩個python版本時,若是直接使用命令行ride.py啓動的將會是ride.py文件,而不是robotmysql
https://blog.csdn.net/sfw_123817/article/details/70225822git
兩個版本並存時,執行ride腳本時容易報錯,解決方案,卸載python3。(5555堅持了這麼久仍是要卸載,好心痛!!!)github
1.Evaluate os.system('python 文件地址') 執行文件時報錯(C:\Python27\python.exe: can't find '__main__' module in 'F:\\Auto_Projects\\RobotWorkspace')web
2.注意盤符方向'python F:/Auto_Projects/study/example100/testexise1.py',windows直接copy後的路徑地址須要手動將\改成/,不然找不到文件sql
2.Screenshot庫使用時,Take Screenshot時會以下報錯chrome
error數據庫
C:\Python27\lib\site-packages\robot\libraries\Screenshot.py:349: wxPyDeprecationWarning: Call to deprecated item EmptyBitmap. Use :class:`wx.Bitmap` instead
bitmap = wx.EmptyBitmap(width, height, -1)
Ending test: MyFirstTest.TSTest.FiveTestjson
3. selenium2library導入後,使用open browser關鍵字時報錯(WebDriverException: Message: 'geckodriver' executable needs to be in PATH. )
4.已經安裝了AutoItLibrary庫和pywin32庫的狀況下,RIDE內導入AutoItLibrary後報紅的問題(F5也不會顯示AutoItLibrary庫)
解決方案:安裝Autoit V3(https://www.autoitscript.com/site/)
# coding=utf-8
class
mytool():
def
__init__(
self
):
pass
def
test_a_b(
self
,a,b):
'''
比較兩個參數的大小
'''
if
a>b:
flag
=
False
return
flag
else
:
flag
=
True
return
flag
|
# coding=utf-8
from
mytoolimport mytool
version
=
'1.0'
class
MyLibrary(mytool):
ROBOT_LIBRARY_SCOPE
=
'GLOBAL'
|
3. RIDE中導入庫,MyLibrary
4. 自定義使用
${r} Test A B 1000 100
log ${r}
|
*自定義庫加載時的注意事項:https://blog.csdn.net/lihua_tan/article/details/54897448
鏈接數據庫(數據庫必須處於啓用狀態,鏈接能夠是斷開的)
Connect
Connect To Database Using Custom Params | pymysql | host='127.0.0.1',port=3306,user='root',passwd='xxxxx',db='xxxx
執行SQL語句
SQL
Connect To Database Using Custom Params | pymysql | host='127.0.0.1',port=3306,user='root',passwd='xxxx',db='xxxx'
${result} | Execute Sql String| select * from students
log ${result}
Disconnect From Database
如上執行後,robotframe中未打印出相應的結果,繼續確認須要!!!!!!!
http://www.javashuo.com/article/p-ugskcezg-cu.html
evaluate:使用此關鍵字後,就能夠直接調用python提供的方法。在RF中直接編寫的內容爲字符串,因此須要藉助python的int()方法轉換爲整型。