无法创建一个新的会话。 (原始错误:需要以下所需的功能,但没有提供:PlatformName,DeviceName)’
这是我的Java代码:
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
public class AppiumCapabilities {
@Test
public void testAppium() throws MalformedURLException{
AndroidDriver driver;
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("platformName", "Android");
capability.setCapability("deviceName", "Nexus 5");
capability.setCapability("udid","039e8ae813aa787d");
capability.setCapability("platformVersion", "6.0.1");
File file = new File("C:\\Users\\ShahreenMushtaq\\workspace1\\Appium\\zameenapk\\app-zameen-
live-release.apk");
capability.setCapability("app", file.getAbsolutePath());
driver = new AndroidDriver(new URL("http://192.168.100.12:4723/wd/hub"),capability);
}
}
错误:
info:[debug]以错误:{“状态”:33,“ value”:{“消息”:“无法创建一个新的会话。(原始错误:需要以下所需的功能,但没有提供:PlatformName,deviceName)”,“ Origvalue”:“需要以下所需的功能,但没有提供:PlatformName,deviceName“},“ sessionId”:null} 信息:< - POST/WD/HUB/SESSION 500 3.228 MS -314
我已经在现有会话中重新启动了Appium。我的appium设置如下所示:
Here is my Java code:
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
public class AppiumCapabilities {
@Test
public void testAppium() throws MalformedURLException{
AndroidDriver driver;
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("platformName", "Android");
capability.setCapability("deviceName", "Nexus 5");
capability.setCapability("udid","039e8ae813aa787d");
capability.setCapability("platformVersion", "6.0.1");
File file = new File("C:\\Users\\ShahreenMushtaq\\workspace1\\Appium\\zameenapk\\app-zameen-
live-release.apk");
capability.setCapability("app", file.getAbsolutePath());
driver = new AndroidDriver(new URL("http://192.168.100.12:4723/wd/hub"),capability);
}
}
Error:
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: platformName, deviceName)","origValue":"The following desired capabilities are required, but were not provided: platformName, deviceName"},"sessionId":null}
info: <-- POST /wd/hub/session 500 3.228 ms - 314
I have already restarted the Appium with Override Existing Session. My Appium settings are shown below:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论