簡體   English   中英

org.openqa.selenium.SessionNotCreatedException:無法創建新的會話。 (原始錯誤:'java -version'失敗。錯誤:產生ENOENT)

[英]org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)

package android.appium;


import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.testng.annotations.AfterTest;

import io.appium.java_client.AppiumDriver;

import java.net.URL;
import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;



public class SimpleTestCalc {

    WebDriver driver;
  @BeforeTest
  public void setup () throws MalformedURLException {
      DesiredCapabilities capabilities=new DesiredCapabilities();
        capabilities.setCapability("deviceName","ZX1PC2JJPM");
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
        capabilities.setCapability(CapabilityType.VERSION, "5.1");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("appPackage", "com.android.calculator2");
        capabilities.setCapability("appActivity", "com.android.calculator2.calculator");
        URL url1=new URL("http://127.0.0.1:4723/wd/hub");
        driver=new RemoteWebDriver(url1,capabilities);
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  }

  @Test
  public void sum() {
      driver.findElement(By.name("2")).click();
        driver.findElement(By.name("5")).click();
        driver.findElement(By.name("+")).click();
        driver.findElement(By.name("5")).click();
        driver.findElement(By.name("=")).click();
        String result=driver.findElement(By.className("android.widget.EditText")).getText();
        System.out.print("Sum of values is"+result);

  }

  @AfterTest
  public void reset() {
        driver.quit();
  }

}

輸出:

[TestNG]正在運行:

C:\\ Users \\用戶vgaarlap.ORADEV \\應用程序數據\\本地的\\ Temp \\ TestNG的月食 - 1070157593 \\ TestNG的-customsuite.xml

失敗的配置:@BeforeTest設置org.openqa.selenium.SessionNotCreatedException:無法創建新的會話。 (原始錯誤:“ java -version”失敗。錯誤:spawn ENOENT)(警告:服務器未提供任何堆棧跟蹤信息)命令持續時間或超時:149毫秒構建信息:版本:'2.53.0',修訂版:'35ae25b ',時間:'2016-03-15 16:57:40'系統信息:主機:'VGAARLAP-LAP',ip:'192.168.56.1',操作系統名稱:'Windows 7',os.arch:'amd64 ',os.version:'6.1',java.version:'1.8.0_31'驅動程序信息:位於sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)的org.openqa.selenium.remote.RemoteWebDriver(位於Sun.reflect.NativeConstructorAccessorImpl。 newInstance(NativeConstructorAccessorImpl.java:62)位於sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

您需要在環境路徑變量中添加system32位置。

%SystemRoot%system32

有關更多詳細信息,請參見以下鏈接:

https://discuss.appium.io/t/original-error-java-version-failed-error-spawn-enoent/3125

暫無
暫無

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

相關問題 無法創建新的會話。 (原始錯誤:“ java -version”失敗。錯誤:生成ENOENT) org.openqa.selenium.SessionNotCreatedException:無法創建新會話。 (原始錯誤:請求了一個新會話,但正在進行中) org.openqa.selenium.SessionNotCreatedException:消息:無法啟動新的 session。響應代碼 500 錯誤使用 Selenium Java org.openqa.selenium.SessionNotCreatedException:消息:無法啟動新的 session。使用 Appium Java 時出現響應代碼 500 錯誤 org.openqa.selenium.SessionNotCreatedException:無法啟動新的 session。 使用驅動程序 service-docker 容器創建 session 時出錯 Selenium(OSX 和 Linux)拋出錯誤 org.openqa.selenium.SessionNotCreatedException:會話未創建:找不到匹配的功能 org.openqa.selenium.SessionNotCreatedException:無法啟動新的 session.響應碼 500.Message:未知錯誤:無法創建 Chrome 進程 org.openqa.selenium.SessionNotCreatedException:會話未創建斷開連接:無法使用 ChromeDriver 和 Chrome 將消息發送到渲染器錯誤 org.openqa.selenium.SessionNotCreatedException:無法通過 Selenium 和 Java 使用 GeckoDriver 和 Firefox 創建會話錯誤 Appium 錯誤:線程“main”org.openqa.selenium.SessionNotCreatedException 中的異常:無法創建新的遠程會話
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM