appium 的日志:
[HTTP]
[HTTP] --> POST /wd/hub/session/a0e7e628-b024-4f06-9a0b-0686a9f9a202/element
[HTTP] {"using":"id","value":"com.tttrtclive.audio:id/room_id"}
[MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.tttrtclive.audio:id/room_id","a0e7e628-b024-4f06-9a0b-0686a9f9a202"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 10000 ms for condition
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tttrtclive.audio:id/room_id","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tttrtclive.audio:id/room_id","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.tttrtclive.audio:id/room_id' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.tttrtclive.audio:id/room_id]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.tttrtclive.audio:id/room_id' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.tttrtclive.audio:id/room_id]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"No element found"}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[BaseDriver] Waited for 3530 ms so far
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tttrtclive.audio:id/room_id","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.tttrtclive.audio:id/room_id","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.tttrtclive.audio:id/room_id' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.tttrtclive.audio:id/room_id]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.tttrtclive.audio:id/room_id' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.tttrtclive.audio:id/room_id]
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"No element found"}
[HTTP] <-- POST /wd/hub/session/a0e7e628-b024-4f06-9a0b-0686a9f9a202/element 500 11803 ms - 164
[HTTP]
[Logcat] Logcat terminated with code 0, signal null
[UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
[UiAutomator] Moving to state 'stopped'
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Resetting IME to com.baidu.input_bbk.service/.PinyinIME
[ADB] Running '/Users/admin/Desktop/android-sdk-macosx/platform-tools/adb -P 5037 -s e1d2ea29 shell ime set com.baidu.input_bbk.service/.PinyinIME'
[Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
[Appium] Removing session a0e7e628-b024-4f06-9a0b-0686a9f9a202 from our master session list
[ADB] Running '/Users/admin/Desktop/android-sdk-macosx/platform-tools/adb -P 5037 -s e1d2ea29 shell ime set com.baidu.input_bbk.service/.PinyinIME'
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 3 ms - 40
[HTTP]

eclipse 报错日志:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 11.82 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'localhost', ip: 'fe80:0:0:0:c8e:da87:513f:584%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.5', java.version: '1.8.0_181'
Driver info: io.appium.java_client.AppiumDriver
Capabilities [{app=/Users/admin/eclipse-workspace/Test/app/语音通话.apk, appPackage=com.tttrtclive.audio, deviceScreenSize=1080x1920, networkConnectionEnabled=true, noSign=true, warnings={}, databaseEnabled=false, deviceName=e1d2ea29, platform=LINUX, deviceUDID=e1d2ea29, appActivity=com.tttrtclive.ui.SplashActivity, desired={app=/Users/admin/eclipse-workspace/Test/app/语音通话.apk, appPackage=com.tttrtclive.audio, appActivity=com.tttrtclive.ui.SplashActivity, noSign=true, newCommandTimeout=30, platformVersion=7.1.2, automationName=Appium, unicodeKeyboard=true, platformName=Android, deviceName=e1d2ea29, resetKeyboard=true}, newCommandTimeout=30, platformVersion=7.1.2, webStorageEnabled=false, locationContextEnabled=false, automationName=Appium, takesScreenshot=true, javascriptEnabled=true, deviceModel=vivo X9Plus, unicodeKeyboard=true, platformName=Android, deviceManufacturer=vivo, resetKeyboard=true}]
Session ID: a0e7e628-b024-4f06-9a0b-0686a9f9a202
*** Element info: {Using=id, value=com.tttrtclive.audio:id/room_id}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:371)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:420)
at io.appium.java_client.DefaultGenericMobileDriver.findElementById(DefaultGenericMobileDriver.java:70)
at io.appium.java_client.AppiumDriver.findElementById(AppiumDriver.java:1)
at org.openqa.selenium.By$ById.findElement(By.java:218)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at HelloWorld.test(HelloWorld.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

我写的 Java 脚本:
// 音频测试开始的地方
// 输入房间号进入房间
driver.findElement(By.id("com.tttrtclive.audio:id/room_id")).sendKeys("123456");
// 点击进入房间
driver.findElement(By.id("com.tttrtclive.audio:id/enter")).click();
// 点击静音按钮
driver.findElement(By.id("com.tttrtclive.audio:id/main_btn_audio_channel")).click();
// 点击切换扬声筒按钮
driver.findElement(By.id("com.tttrtclive.audio:id/main_btn_audio_ysq")).click();
// 点击退出按钮
driver.findElement(By.id("com.tttrtclive.audio:id/main_btn_exit")).click();


↙↙↙阅读原文可查看相关链接,并与作者交流