Appium Appium 1.6.5 截图 get_screenshot_as_file () 出错

HengF丶 · 2017年07月21日 · 最后由 笑哼 回复于 2018年07月26日 · 3374 次阅读

Appium 日志:

[HTTP] <-- POST /wd/hub/session/ec9936b3-f5d4-4db4-98ee-ef9fc31236be/element 500 170 ms - 164
[HTTP] --> GET /wd/hub/session/ec9936b3-f5d4-4db4-98ee-ef9fc31236be/screenshot {}
[MJSONWP] Calling AppiumDriver.getScreenshot() with args: ["ec9936b3-f5d4-4db4-98ee-ef9fc31236be"]
[ADB] Device API level: 24
[AndroidDriver] Cannot get screenshot data with 'adb exec-out' because of 'Command output is not a valid PNG file ( !== 89504e47)'. Defaulting to 'adb shell' call
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/snhuang/Automation/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","PBV7N16413001175","shell","/system/bin/rm","/data/local/tmp/screenshot.png;","/system/bin/screencap","-p","/data/local/tmp/screenshot.png"]
[ADB] Running '/Users/snhuang/Automation/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","PBV7N16413001175","pull","/data/local/tmp/screenshot.png","/var/folders/m4/rsjymmt563j6h_ywts6ncjk40000gp/T/appium117621-81775-1kxvmcs.289hbmx6r.png"]

到这里就卡死 了,

Python 日志:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/behave/model.py", line 1456, in run
match.run(runner.context)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/behave/model.py", line 1903, in run
self.func(context, args, **kwargs)
File "features/steps/home_page.py", line 67, in step_impl
element = find_toast(context, 10, '//
[@text="提交成功"]', 0.5)
File "/Users/snhuang/Automation/autotest/android/nmoa/Demo/features/common.py", line 133, in find_toast
screen_shot(context, 'toast')
File "/Users/snhuang/Automation/autotest/android/nmoa/Demo/features/common.py", line 17, in screen_shot
context.driver.get_screenshot_as_file(screenShot_path)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 837, in get_screenshot_as_file
png = self.get_screenshot_as_png()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 867, in get_screenshot_as_png
return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 877, in get_screenshot_as_base64
return self.execute(Command.SCREENSHOT)['value']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 254, in execute
response = self.command_executor.execute(driver_command, params)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 464, in execute
return self._request(command_info[0], url, body=data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 526, in _request
resp = opener.open(request, timeout=self._timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1321, in do_open
r = h.getresponse()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

前段时间截图还正常,本地也没改什么东西,appium 也没更新,但突然截图就不行了,求大神指点迷津!!!!!!!!!!!!!!!

共收到 1 条回复 时间 点赞

你好,我也遇到这个问题了,请问你解决没?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册