使用带有Python测试脚本的Appium驱动程序

时间:2015-08-25 14:59:08

标签: python python-2.7 selenium-webdriver appium

我已经多次重构我的脚本以使其正常工作,现在又得到了错误。请有人帮我理解屏幕上显示的内容以及我哪里出错了?

每次在终端内运行时都会收到这些错误。

test_login_valid_password( main .HmaAndroidLoginTest)...错误 test_login_valid_username( main .HmaAndroidLoginTest)...错误

=============================================== =======================

错误:test_login_valid_password(主要 .HmaAndroidLoginTest)

追踪(最近一次通话):   在setUp中输入第13行“Android01.py”     self.driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)   在 init 中输入第37行的文件“build / bdist.macosx-10.10-intel / egg / appium / webdriver / webdriver.py”     super(WebDriver,self)。 init (command_executor,desired_capabilities,browser_profile,proxy,keep_alive)   在 init 中输入文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”,第87行     self.start_session(desired_capabilities,browser_profile)   在start_session中输入文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”,第136行     'desiredCapabilities':desired_capabilities,   文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”,第194行,执行     response = self.command_executor.execute(driver_command,params)   文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py”,第395行,执行     return self._request(command_info [0],url,body = data)   在_request中输入文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py”,第463行     resp = opener.open(request,timeout = self._timeout)   文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第431行,打开     response = self._open(req,data)   文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第449行,在_open中     '_open',req)   文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第409行,在_call_chain中     result = func(* args)   在http_open中输入文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第1227行     return self.do_open(httplib.HTTPConnection,req)   在do_open中输入文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第1197行     提出URLError(错误) URLError:

=============================================== =======================

错误:test_login_valid_username(主要 .HmaAndroidLoginTest)

追踪(最近一次通话):   在setUp中输入第13行“Android01.py”     self.driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)   在 init 中输入第37行的文件“build / bdist.macosx-10.10-intel / egg / appium / webdriver / webdriver.py”     super(WebDriver,self)。 init (command_executor,desired_capabilities,browser_profile,proxy,keep_alive)   在 init 中输入文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”,第87行     self.start_session(desired_capabilities,browser_profile)   在start_session中输入文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”,第136行     'desiredCapabilities':desired_capabilities,   文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”,第194行,执行     response = self.command_executor.execute(driver_command,params)   文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py”,第395行,执行     return self._request(command_info [0],url,body = data)   在_request中输入文件“/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py”,第463行     resp = opener.open(request,timeout = self._timeout)   文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第431行,打开     response = self._open(req,data)   文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第449行,在_open中     '_open',req)   文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第409行,在_call_chain中     result = func(* args)   在http_open中输入文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第1227行     return self.do_open(httplib.HTTPConnection,req)   在do_open中输入文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”,第1197行     提出URLError(错误) URLError:

在0.014s中进行2次测试

失败(错误= 2)

1 个答案:

答案 0 :(得分:0)

好的,所以我认为这是Appium Server没有运行的情况,每次运行一组新的测试时,都必须刷新Appium Server。

同样整理脚本,测试通过了。