简体   繁体   English

尝试在Android上打开Goog​​le Chrome浏览器时出现“无法启动Appium会话,错误是:错误:生成ENOENT”错误消息

[英]“Failed to start an Appium session, err was: Error: spawn ENOENT” error message while trying to open a google chrome browser on Android

I have written a simple code to just open google chrome browser on Android launch a web url and to close the browser, below is my code: 我编写了一个简单的代码,仅在Android上打开Goog​​le chrome浏览器,启动Web网址并关闭浏览器,以下是我的代码:

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 

On Eclipse I am getting the following error: 在Eclipse上,我收到以下错误:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. 线程“主”中的异常org.openqa.selenium.SessionNotCreatedException:无法创建新的会话。 (Original error: spawn ENOENT) (原始错误:产生ENOENT)

I am not able to understand why the above error message is coming. 我无法理解为什么出现以上错误消息。

Below are the versions software tat I am using 以下是我使用的tat软件的版本

Selenium Server Sstandalone: 2.53.1
Java Client for Appium 4.1.2
Appium Version: 1.4.13.1

please help in resolving the issue, I am very new to APPIUM. 请协助解决问题,我对APPIUM还是陌生的。

升级Appium Server 1.6.4后,问题已解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法启动Appium会话,错误是:错误:应用程序错误: - Failed to start an Appium session, err was: Error: Bad app: Appium:错误:无法启动Appium会话,错误是:错误:&#39;java -version&#39;失败 - Appium: error: Failed to start an Appium session, err was: Error: 'java -version' failed Android:打开失败:ENOENT(无此类文件或目录)错误 - Android: open failed: ENOENT (No such file or directory) Error 无法启动Appium会话。错误是:错误:“ java -version”失败 - Failed to start an Appium session.Error was: Error: 'java -version' failed 尝试写入文件时出现Android ENOENT错误 - Android ENOENT error while trying to write a file 错误:Logcat捕获失败:生成ENOENT - error: Logcat capture failed: spawn ENOENT 无法创建新的会话。 (原始错误:“ java -version”失败。错误:生成ENOENT) - A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT) Selenium - 无法启动 Selenium 会话:无法启动新的浏览器会话:启动浏览器时出错 - Selenium - Could not start Selenium session: Failed to start new browser session: Error while launching browser Android方法openFileOutput获取“打开失败:ENOENT”错误 - Android method openFileOutput get “open failed: ENOENT” error java.io.FileNotFoundException:打开失败:android中的ENOENT错误 - java.io.FileNotFoundException: open failed: ENOENT error in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM