Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java &引用;启动应用程序会话失败,错误为:错误:spawn enoint";尝试在Android上打开google chrome浏览器时出现错误消息_Java_Android_Google Chrome_Selenium_Appium - Fatal编程技术网

Java &引用;启动应用程序会话失败,错误为:错误:spawn enoint";尝试在Android上打开google chrome浏览器时出现错误消息

Java &引用;启动应用程序会话失败,错误为:错误:spawn enoint";尝试在Android上打开google chrome浏览器时出现错误消息,java,android,google-chrome,selenium,appium,Java,Android,Google Chrome,Selenium,Appium,我写了一个简单的代码,只需在Android上打开google chrome浏览器,启动一个web url,然后关闭浏览器,下面是我的代码: package com.roofandfloor.initial; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import or

我写了一个简单的代码,只需在Android上打开google chrome浏览器,启动一个web url,然后关闭浏览器,下面是我的代码:

package com.roofandfloor.initial;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class SampleCode {

    public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities capabilities = DesiredCapabilities.android();
        capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
        capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Micromax");
        capabilities.setCapability(MobileCapabilityType.VERSION, "5.0");
        URL url = new URL("http://127.0.0.1:4723/wd/hub");
        WebDriver driver = new AndroidDriver<>(url,capabilities);
        driver.get("https://www.facebook.com");
        driver.quit();

    }

}

I am getting an error at the line "WebDriver driver = new AndroidDriver<>(url,capabilities);"

below is the logs from APPIUM:

> info: --> POST /wd/hub/session {"desiredCapabilities":{"browserName":"chrome","platformName":"Android","version":"5.0","deviceName":"Micromax","platform":"ANDROID"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_131)
> info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version, platform
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session 4af282c8-e0e4-45c3-873c-3d10ccfc5229
> info: [debug] Checking whether adb is present
> warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
> info: [debug] executing cmd: where adb
> info: [debug] Using adb from C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe
> 
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: "C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe" devices
> info: [debug] 1 device(s) connected
> info: Found device 0123456789ABCDEF
> info: [debug] Setting device id to 0123456789ABCDEF
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: "C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe" -s 0123456789ABCDEF wait-for-device
> info: [debug] executing cmd: "C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe" -s 0123456789ABCDEF shell "echo 'ready'"
> info: [debug] Starting logcat capture
> error: Logcat capture failed: spawn ENOENT
> info: [debug] Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: spawn ENOENT
> info: [debug] Error: spawn ENOENT
>     at errnoException (child_process.js:988:11)
>     at Process.ChildProcess._handle.onexit (child_process.js:779:34)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 6536.205 ms - 197 

请帮助解决这个问题,我是APPIUM的新手。

升级APPIUM Server 1.6.4后,问题得到了解决。

我使用的操作系统是windows 10,我使用Eclipse Neon运行我的Java代码
Selenium Server Sstandalone: 2.53.1
Java Client for Appium 4.1.2
Appium Version: 1.4.13.1