所以我想寫一個自動化測試腳本的Android模擬器(AVD)內運行的Android應用程序,但我在Appium日誌得到如下的錯誤:Appium和虛擬Android設備所需的功能:SessionNotCreatedException錯誤
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect.
We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities
","capabilities","sessionId","id","sessionId","id"]} and you sent ["desiredCapab
ilities","requiredCapabilities","capabilities","alwaysMatch","firstMatch"]
我的設置是:
- 的Android工作室162(W/SDK,請注意,這個最新版本不包括「機器人」命令了,Android的虛擬設備的創建是通過工具實現>安卓> AVD Manager)
- 的IntelliJ 2016年3月5日(用於編寫自動測試腳本)
- 硒的Java 3.3.0(所需的jar)
- appium Java客戶端4.1.2(所需的jar)
- appium服務器1.6.3(在執行通過的NodeJS運行 'appium')
- Android虛擬設備5.1版棒棒糖
運行cli來 'ADB設備' 在cmd命令給我
List of devices attached
emulator-5554 device
期望的能力設置爲運行測試時
@BeforeClass
public void setUp() throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName","Android");
capabilities.setCapability("platformVersion","5.1");
capabilities.setCapability("deviceName","emulator-5554");
capabilities.setCapability("app", path_to_apk);
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
IDE錯誤輸出:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=src//main//resources//test.apk, platformVersion=5.1, platformName=Android, deviceName=emulator-5554}], required capabilities = Capabilities [{}]
Build info: version: '3.3.0', revision: 'b526bd5b41', time: '2017-03-07 19:26:04 +0000'
我停留在這一點上,不知道該怎麼辦。
請注意,設備名稱不是「emulator-5554」 - 這是devices udid。 –
通過使用Selenium-Java 3.0.1來管理解決這個問題 – jeffsia
@jeffsia有沒有更新?你有沒有想過? – SelenUser