请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

运行java application时,总是报错

运行java application时,总是报以下错误

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{appPackage=com.zhihu.android, appActivity=.app.ui.activity.MainActivity, platforName=Android, platformVersion=7.0, automationName=Appium, resertKeyboard=true, unicodeKeyboard=true, deviceName=lge-nexus_4-005475cbccd279d4}], required capabilities = Capabilities [{}]

Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'

System info: host: 'DESKTOP-L4A6UVL', ip: '10.33.96.88', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'

Driver info: driver.version: AppiumDriver

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)

at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)

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.startSession(RemoteWebDriver.java:241)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)

at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)

at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:89)

at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:113)

at com.appium.test.AppTest.main(AppTest.java:27)


正在回答 回答被采纳积分+3

2回答

城下秋草 2017-03-23 20:27:25

这个错误应该是之前的appium没有正常退出。关闭server后重启再运行。 代码中注意要执行driver.quit

0 回复 有任何疑惑可以回复我~
yesir 2017-04-06 17:06:30

关闭了server再次打开还是报错

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{appPackage=com.tencent.mm, appActivity=com.tencent.mm.ui.LauncherUI, app=C:\apps\wechat_debug.apk, platformVersion=5.1.1, automationName=Appium, unicodeKeyboard=true, platformName=Android, deviceName=cf9bc26b, resetKeyboard=true}], required capabilities = Capabilities [{}]
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'USER-20151123YC', ip: '192.168.131.227', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: AndroidDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:36)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:114)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:132)
    at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:92)
    at com.sup.ye.AppTest01.main(AppTest01.java:28)
https://img1.sycdn.imooc.com/szimg//58e606b500019de807380289.jpg

0 回复 有任何疑惑可以回复我~
  • yesir #1
    如果用<>就要报错,用new AppiumDriver也会报错
    回复 有任何疑惑可以回复我~ 2017-04-06 17:14:54
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信