我尝试在PyCharm中运行一个简单的机器人框架脚本。这是我的代码:
*** Settings ***
Documentation This is some basic info about the whole suite
Library Selenium2Library
*** Variables ***
*** Test Cases ***
User must sign in to check out
[Documentation] This is some basic info about the test
[Tags] Smoke
Open Browser http://www.google.com.ua chrome
Close Browser
我使用PyCharm定制了机器人框架,就像在视频中一样,但是当我在PyCharm终端中运行这个脚本时,所需的网站没有打开,我得到了下一个信息:
C:\Users\user\PycharmProjects\amazon>
C:\Users\user\PycharmProjects\amazon>pybot -d results tests/Amazon.robot
Amazon :: This is some basic info about the whole suite
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open
User must sign in to check out :: This is some basic info about th... | FAIL |
error: [Errno 10054]
------------------------------------------------------------------------------
Amazon :: This is some basic info about the whole suite | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: C:\Users\user\PycharmProjects\amazon\results\output.xml
Log: C:\Users\user\PycharmProjects\amazon\results\log.html
Report: C:\Users\user\PycharmProjects\amazon\results\report.html
请告诉我,为什么这个脚本不会打开浏览器和它应该执行的操作,为什么我会收到此错误。谢谢。
答案 0 :(得分:1)
如果您发布的代码字面上是您的代码,那么您在chrome
行open browser
之前至少缺少一个空格。 URL和浏览器之间必须有两个或多个空格。
这可能不是唯一的问题,但它肯定是一个问题。