参考:
https://www.ibm.com/developerworks/cn/opensource/os-cn-robot-framework/index.html
1、python 2.7下载安装(添加环境变量,重新打开cmd窗口)
https://www.python.org/downloads/
(快速下载地址,如失效请从官网下载:https://pan.baidu.com/s/1kWJQ8kv)
安装路径我选择E:\Python27,添加到path环境变量:E:\Python27;E:\Python27\Scripts;
2、安装python有自带,可跳过,这里是单独pip安装方式(添加环境变量,重新打开cmd窗口)
参考:https://jingyan.baidu.com/article/b907e627a072a846e6891c5a.html
在 https://pypi.python.org/pypi/pip#downloads 页面下载 pip-9.0.1.tar.gz然后解压
用CMD控制台进入解压目录,输入:python setup.py install
添加path环境变量,我的是:E:\Python27\Scripts;
3、wxPathon安装
虽然是64位系统,但python是32位的,wxPathon也要安装(32位)才能识别:
http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
(快速下载地址,如失效请从官网下载:https://pan.baidu.com/s/1smD8Hqd)
有坑,参考:https://www.cnblogs.com/chen8chen/p/6831339.html
4、bat执行方式安装其他组件:
先cd 进入python27目录,bat文件内容:
pip install virtualenv virtualenv --system-site-packages robot3 cd robot3/scripts/ call activate.bat
重新以管理员身份运行cmd.exe,进入python27目录
pip install robotframework==3.0.2 pip install robotframework-ride==1.5.2.1 pip install robotframework-seleniumlibrary==3.0.1 pip install robotframework-selenium2library pip install robotframework-excellibrary pip install robotframework-databaselibrary pip install pyodbc pip install robotframework-requests pip install -U robotframework-databaselibrary pip install chardet pip install pymysql python ./Scripts/ride.py
装完后如果没出错就会执行RIDE窗口。
当然,要查下ride.py装在哪,python目录找不到,我使用Everything快速搜索整个电脑的文件
5、快速运行RIDE,直接cmd执行:
cd /d G:\downloads\robot3\Scripts
start python "ride.py"
6、创建ride桌面快捷方式
第一步,在桌面点击鼠标右键,新建一个“快捷方式”,在弹出框输入:
E:\Python27\pythonw.exe -c "from robotide import main; main()"
并点击下一步;
第二步,随你任意起一个名字,建议使用“RIDE”较为正规并点击“完成”;
附:
在运行chrome测试时,如果报错(WebDriverException: Message: 'chromedriver' executable needs to be in PATH),那么得下载驱动
(WebDriver.ChromeDriver.win32.2.33.0.0)(chromedriver.zip)
(WebDriver.ChromeDriver.win32.2.34.0.0)(chromedriver.zip)
(WebDriver.ChromeDriver.win32.2.35.0.0)(chromedriver.zip)
(WebDriver.ChromeDriver.win32.2.36.0.0)(chromedriver.zip)
可以解压直接把exe文件放到python目录
各版本chrome驱动下载网址:http://chromedriver.storage.googleapis.com/index.html
----------ChromeDriver v2.35 (2018-01-10)---------- Supports Chrome v62-64 Resolved issue 2191: Executing JavaScript code fails if the script returns no result [[Pri-1]] Resolved issue 2183: Connections Aren't Persistent [[Pri-2]] Resolved issue 2207: Some mobile emulation devices do not work [[Pri-2]] Resolved issue 2177: Get local storage returns command names in Chrome 63 [[Pri-2]] Resolved issue 2179: absolute time on log entries [[Pri-2]] ----------ChromeDriver v2.34 (2017-12-10)---------- Supports Chrome v61-63 Resolved issue 2025: Incorrect navigation on Chrome v63+ [['Pri-0']] Resolved issue 2034: Error looking for "Timeline.start" in Chrome [['Pri-2']] Resolved issue 1883: Unable to emulate android devices with Chromedriver 2.30 [['Pri-2']] Resolved issue 2103: Touch in mobile emulation doesn't work [[]] ----------ChromeDriver v2.33 (2017-10-03)---------- Supports Chrome v60-62 Resolved issue 2032: ChromeDriver crashes while creating DNS resolver [['Pri-1']] Resolved issue 1918: Get/SetWindowSize & Get/SetWindowPosition commands are failing on Chromev62+ [['Pri-1']] Resolved issue 2013: Android 8.0.0 webviews not supported [['Pri-2']] Resolved issue 2017: In mobileEmulation "element is not clickable" if it is outside the visible area [['Pri-2']] Resolved issue 1981: chromedriver does not respect excludeSwitches flag [['Pri-2']] Partially Resolved issue 2002: Add Cookie is not spec compliant [[]] Resolved issue 1985: FindElement raises the wrong error [[]] ----------ChromeDriver v2.32 (2017-08-30)---------- Supports Chrome v59-61 Resolved issue 1852: Error 'Element is not clickable at point' occurs on Chrome v61+ [['Pri-1']] Resolved issue 1950: DeleteCookie in Chrome v62 and Chromedriver v2.31 fails [['Pri-2']] Resolved issue 1942: ChromeDriver response in W3C mode is not standard compliant [['Pri-2']] Resolved issue 1910: Fails to retrieve default prompt text on Chrome v62+ [['Pri-2']] Resolved issue 1900: LaunchApp command throws UnknownError: cannot get automation extension on Mac and Windows Chrome v62+ [['Pri-2']] Resolved issue 1885: unknown error: Cannot use 'in' operator to search for 'String' in null [['Pri-2']] Resolved issue 1882: Chromedriver URI for Execute Async Script is not spec compliant [['Pri-3']] Resolved issue 1621: Implement session/<session id>/window/fullscreen command [['Pri-3']] Resolved issue 1896: Characters '3' and '#' are not being entered using SendKeys on Mac Chrome v62+ [[]] Resolved issue 1894: chromedriver 2.31 should be linked with glibc 2.17 [[]] Resolved issue 1740: ChromeDriver session handshake needs to be W3C compliant [[]] Resolved issue 1898: Wrong error is thrown while sending text to non prompt dialog. [[]] Resolved issue 1888: Chromedriver doesn't throw an exception when uploading an invalid file with selenium [[]] ----------ChromeDriver v2.31 (2017-07-21)---------- Supports Chrome v58-60 Resolved issue 1804: Flakiness when retrieving cookies using GetCookies command on Windows [['Pri-1']] Resolved issue 1879: Implement /session/{session id}/cookie/{name} command [['Pri-2']] Resolved issue 1860: WebDriverException: Message: unknown error: bad inspector message:"" when attempting to get page_source [['Pri-2']] Resolved issue 1293: Timed out receiving message from renderer on window.location change [['Pri-2']] Resolved issue 1849: ChromeDriver 2.30 AddCookie command uses incorrect default path [['Pri-2']] Resolved issue 1256: switchToFrame should throw StaleElementReferenceException in case the element is stale [['Pri-2']] Resolved issue 1786: Feature request: change chromeOptions to goog:chromeOptions [['Pri-3']] Resolved issue 1772: Chromedriver running against canary chrome w/ headless flag requires XVFB for sendKey interactions [[]] Resolved issue 727979: Failed to set Chrome's command line file on device for long command line [['Pri-3']] ----------ChromeDriver v2.30 (2017-06-07)---------- Supports Chrome v58-60 Resolved issue 644: ChromeDriver does not delete the profile & scoped_dir* folders after test exits [['Pri-1']] Resolved issue 1114: unknown error:Maximum call stack size exceeded on calling any webdriver command [['OS-All', 'Pri-1']] Resolved issue 1773: ChromeDriver crashes when using console.time on Chromev58+ [['OS-All', 'Pri-1']] Resolved issue 1526: mobileEmulation not working for the listed devices in the chrome [['Pri-2']] Resolved issue 1777: NoSuchFrameException is thrown when attempting to focus on a frame with protocol "chrome-extension://" within a page with protocol "https://" on Chrome 58 [['OS-All', 'Pri-2']] Resolved issue 1779: testWindowMaximize is failing on Mac for Chrome v60+ [['OS-Mac', 'Pri-2']] Resolved issue 1775: testShouldHandleNewWindowLoadingProperly failing on Chrome v60+ [['OS-All', 'Pri-2']] Resolved issue 1796: Chromedriver failed to connect to Chrome on CrOS with latest canary build [[]] Resolved issue 1353: Sending text to Alert / Confirm dialog should throw element not visible exception [[]]
简单的test case
引入库:Selenium2Library
*** Settings *** Library Selenium2Library *** Test Cases *** Testcase1 Open Browser http://www.baidu.com chrome Input Text id=kw pukuimin Click Button id=su Sleep 4s Close Window
执行testcase,如果没错,就应该包含类似 1 passed 提示:
command: pybot.bat --argumentfile c:\users\admini~1\appdata\local\temp\RIDEgjsbp2.d\argfile.txt --listener E:\Python27\robot3\lib\site-packages\robotide\contrib\testrunner\TestRunnerAgent.py:10126:True E:\Python27\robot3\Scripts\testProject1 =========================================================================== testProject1 =========================================================================== testProject1.Testsuit1 =========================================================================== Testcase1 | PASS | --------------------------------------------------------------------------- testProject1.Testsuit1 | PASS | 1 critical test, 1 passed, 0 failed 1 test total, 1 passed, 0 failed =========================================================================== testProject1 | PASS | 1 critical test, 1 passed, 0 failed 1 test total, 1 passed, 0 failed =========================================================================== Output: c:\users\admini~1\appdata\local\temp\RIDEgjsbp2.d\output.xml Log: c:\users\admini~1\appdata\local\temp\RIDEgjsbp2.d\log.html Report: c:\users\admini~1\appdata\local\temp\RIDEgjsbp2.d\report.html test finished 20180125 22:27:41
常见问题解决方案:
定位参考:
http://www.cnblogs.com/yufeihlf/p/5717291.html
用法参考:
https://www.cnblogs.com/yufeihlf/p/5949984.html
https://testerhome.com/topics/9024
评论列表: