同樣的 code, 在 iPad2 上運行沒問題, 在 iPad3 上運行到 take screenshot 時就錯誤
log 顯示 command timeout, 似乎是因為 retina device 圖像比較大所以複製稍微慢了一點就 timeout?
不知道有沒有人有解決的辦法, 感謝
appium log:
debug: Socket data received (25 bytes)
debug: Socket data being routed.
debug: Got result from instruments: {"status":0,"value":""}
debug: Responding to client with success: {"status":0,"value":"","sessionId":"0de2d378-ebfa-41ba-8caf-2407726b0454"}
info: <-- POST /wd/hub/session/0de2d378-ebfa-41ba-8caf-2407726b0454/element/2/click 200 1314.346 ms - 74 {"status":0,"value":"","sessionId":"0de2d378-ebfa-41ba-8caf-2407726b0454"}
info: --> GET /wd/hub/session/0de2d378-ebfa-41ba-8caf-2407726b0454/screenshot {}
debug: Pushing command to appium work queue: "au.getScreenOrientation()"
debug: Sending command to instruments: au.getScreenOrientation()
debug: Sending command to instruments: au.getScreenOrientation()
debug: [INST] 2014-07-17 06:40:22 +0000 Debug: evaluation finished
debug: [INST] 2014-07-17 06:40:22 +0000 Debug: responding with:
debug: [INST] 2014-07-17 06:40:22 +0000 Debug: Running system command #10: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
debug: [INST] 2014-07-17 06:40:27 +0000 Debug: Got new command 10 from instruments: au.getScreenOrientation()
debug: [INST] 2014-07-17 06:40:27 +0000 Debug: evaluating au.getScreenOrientation()
debug: [INST] 2014-07-17 06:40:27 +0000 Debug: evaluation finished
debug: [INST] 2014-07-17 06:40:27 +0000 Debug: responding with:
debug: [INST] 2014-07-17 06:40:27 +0000 Debug: Running system command #11: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":"PORTRAIT"}...
debug: Socket data received (33 bytes)
debug: Socket data being routed.
debug: Got result from instruments: {"status":0,"value":"PORTRAIT"}
debug: Setting internal orientation to PORTRAIT
debug: Pushing command to appium work queue: "au.capture('screenshot18e6ea0d-da2f-401f-92e0-e7bf05c80daa')"
debug: Sending command to instruments: au.capture('screenshot18e6ea0d-da2f-401f-92e0-e7bf05c80daa')
debug: Sending command to instruments: au.capture('screenshot18e6ea0d-da2f-401f-92e0-e7bf05c80daa')
debug: [INST] 2014-07-17 06:40:28 +0000 Debug: Got new command 11 from instruments: au.capture('screenshot18e6ea0d-da2f-401f-92e0-e7bf05c80daa')
debug: [INST] 2014-07-17 06:40:28 +0000 Debug: evaluating au.capture('screenshot18e6ea0d-da2f-401f-92e0-e7bf05c80daa')
debug: [INST] 2014-07-17 06:40:28 +0000 Debug: target.captureRectWithName("{origin:{x:0.00,y:0.00}, size:{height:1024.00,width:768.00}}", "screenshot18e6ea0d-da2f-401f-92e0-e7bf05c80daa")
debug: Socket data received (25 bytes)
debug: Socket data being routed.
debug: Got result from instruments: {"status":0,"value":""}
debug: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: Timed out waiting for screenshot file. Error: ENOENT, open '/tmp/appium-instruments/Run 1/screenshotf4cfdde6-894f-4eff-8621-e71f7d16aabf.png')","origValue":"Timed out waiting for screenshot file. Error: ENOENT, open '/tmp/appium-instruments/Run 1/screenshotf4cfdde6-894f-4eff-8621-e71f7d16aabf.png'"},"sessionId":"b941e4fa-cbdc-4392-ae9a-29cf5c64e98c"}
info: <-- GET /wd/hub/session/b941e4fa-cbdc-4392-ae9a-29cf5c64e98c/screenshot 500 9846.702 ms - 470
screenshot code
public static void screenshot() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = sdf.format(date);
File srcFile = (File) (((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE));
try {
FileUtils.copyFile(srcFile, new File("/Users/Documents/screenshot/" + dateString + ".jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
有人說修改 appium 參數即可, 可是不知道要修改哪個檔案的參數?
appium version 1.2