簡體   English   中英

SeleniumError:org.openqa.selenium.SessionNotCreatedException

[英]SeleniumError : org.openqa.selenium.SessionNotCreatedException

在執行driver.close();driver.quit(); 在執行Java代碼期間,將引發以下錯誤:

線程“主”中的異常org.openqa.selenium.SessionNotCreatedException:嘗試在不建立連接的情況下運行命令構建信息:版本:'3.6.0',修訂版:'6fbf3ec767',時間:'2017-09-27T16:15: 26.402Z'系統信息:主機:'ADMIN-PC',ip:'192.168.1.6',操作系統名稱:'Windows 10',os.arch:'x86',os.version:'10 .0',java.version :“ 1.8.0_151”驅動程序信息:org.openqa.selenium.firefox.FirefoxDriver功能[{moz:profile = C:\\ Users \\ admin \\ AppData \\ Local \\ Temp \\ rust_mozprofile.ENTBvl2aDbSs,rotatable = false,超時= {隱式= 0,pageLoad = 300000,腳本= 30000},pageLoadStrategy = normal,moz:headless = false,平台= XP,specificationLevel = 0,moz:accessibilityChecks = false,acceptInsecureCerts = true,browserVersion = 56.0.2,platformVersion = 10.0, moz:processID = 5004,browserName = firefox,javascriptEnabled = true,platformName = XP}]會話ID:位於sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native方法)處的sun.reflect.NativeConstructorAccessorImpl處的82e7dabd-c178-4d90-a3f8-84dc3f6ff14f org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java上的sun.reflect.DelegatingConstructorAccessorImpl.newInstance(未知源)在java.lang.reflect.Constructor.newInstance(未知源) :185),位於org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:120),位於org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodea.open org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)上的selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoWeb。 yahoo.main(yahoo.java)上org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:482)上org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:643)上的java:586) :34)

共享引發上述異常的代碼:

//package basicSeleniumScripts;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class yahoo {

public static void main(String[] args) {
    String Firefoxdriverpath = "C:\\Marionette\\geckodriver_1.exe";
    WebDriver driver;

    System.setProperty("webdriver.gecko.driver",Firefoxdriverpath);
    //create a new instance of Firefox driver
    driver = new FirefoxDriver();
    //Open the page we want to open
    driver.get("http://www.yahoo.com");
    //Defining expected title 
    String expectedTitle = "Yahoo";
    //Getting the actual title
    String actualTitle = null;
    actualTitle = driver.getTitle();

    //Validating the TestCase

    if (actualTitle.contentEquals(expectedTitle))
    {
        System.out.println("Test Passed");
    }

    else 
        {
        System.out.println("Test Failed!!!");
        }
    driver.close();
    driver.quit();
}


}

使用3.6.0罐硒時,將gecko驅動程序版本更新為v0.19.0。

也只能使用退出方法

暫無
暫無

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

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