簡體   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

我編寫了一個簡單的代碼,僅在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 

在Eclipse上,我收到以下錯誤:

線程“主”中的異常org.openqa.selenium.SessionNotCreatedException:無法創建新的會話。 (原始錯誤:產生ENOENT)

我無法理解為什么出現以上錯誤消息。

以下是我使用的tat軟件的版本

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

請協助解決問題,我對APPIUM還是陌生的。

升級Appium Server 1.6.4后,問題已解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM