我正在学习Appium,我无法创建尝试更改设备的远程会话
错误消息:
An unknown server-side error occurred while processing the command
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LAPTOP-78EHS656', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_241'
Driver info: driver.version: AppiumDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
这是我的代码
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
public class AppiumTrialTest {
public static void main(String[] args) throws MalformedURLException {
// TODO Auto-generated method stub
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "Samsung A30");
cap.setCapability("udid", "RR8M70339HL");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "9"); //android version
cap.setCapability("appPackage", "com.sec.android.app.camera");//ung nasa appinfo apk
cap.setCapability("appActivity", "com.sec.android.app.camera.Camera");
URL url = new URL("http://127.0.0.1:4723/wd/hub");
AppiumDriver driver = new AppiumDriver<MobileElement>(url,cap);
}
}