android+桌面+同步+getscreenshot(),[求助]appium 用 selendroid 模式的话,使用截图 (get_screenshot_as_png),得到的文件是坏的文件...

appium 用 selendroid 模式的话,使用截图(get_screenshot_as_png),得到的文件是裂图。但是用 uiautomator 模式的话,正常的获取截图。请问一下为什么

脚本如下:

png =self.driver.get_screenshot_as_png()

with open(r'./snapshot/2.png', 'wb') as f:

f.write(png)

self.driver.find_element_by_id("login").click()

当执行

png =self.driver.get_screenshot_as_png()

with open(r'./snapshot/2.png', 'wb') as f:

f.write(png)

这脚本的时候,保存的图片无法打开

appium 的输出

info:

info: --> GET /wd/hub/session/c280aadf-e288-0593-c314-053a47d1665b {}

info: [debug] Proxying command to localhost:4444

info: [debug] Making http request with opts: {"url":"http://localhost:4444/wd/hub/session/c280aadf-e288-0593-c314-053a47d1665b,method:GET"}

info: [debug] Proxied response received with status 200: {"value":{"automationName":"selendroid","platform":"android","app":"/Users/zhouminyi/Downloads/Friday.apk","acceptSslCerts":true,"javascriptEnabled":true,"browserName":"selendroid","appActivity":"com.xtuone.android.friday.InitActivity","networkConnectionEnabled":true,"rotatable":true,"desired":{"automationName":"Selendroid","app":"/Users/zhouminyi/Downloads/Friday.apk","deviceName":"","platformName":"Android","appActivity":"com.xtuone.android.friday.InitActivity","unicodeKeyboard":true,"resetKeyboard":true,"appPackage":"com.xtuone.android.syllabus","plateformVersion":"4.4.4"},"appPackage":"com.xtuone.android.syllabus","version":"0.16.0","platformVersion":"19","deviceName":"","platformName":"android","handlesAlerts":true,"unicodeKeyboard":true,"resetKeyboard":true,"warnings":{},"takesScreenshot":true,"plateformVersion":"4.4.4"},"status":0,"sessionId":"c280aadf-e288-0593-c314-053a47d1665b"}

info:

info: --> GET /wd/hub/session/c280aadf-e288-0593-c314-053a47d1665b/screenshot {}

当执行完保存图片的时候,再次执行操作

self.driver.find_element_by_id("login").click()

同时如果执行截图后,再次执行点击(click()) 等方法,

appium 后台报错显示

Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"Did not successfully proxy server command"},"sessionId":"c280aadf-e288-0593-c314-053a47d1665b"}

info:

控制台输出报错:

WebDriverException: Message: An unknown server-side error occurred while processing the command.

是不是 selendroid 的情况下,无法保存图片

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值