2016-11-09 49 views
1

我建立我的第一個硒刮刀,和我得到的錯誤: 異常線程「main」 org.openqa.selenium.SessionNotCreatedException:無法創建新的遠程會話。所需的能力=能力[{ensureCleanSession = TRUE,browserName = IE瀏覽器,版本=,平臺= WINDOWS}],要求的能力=能力[{}]硒Internet Explorer的駕駛者希望功能錯誤

以下代碼

import java.io.*; 

import org.apache.commons.io.FileUtils; 
import org.openqa.selenium.By; 
import org.openqa.selenium.OutputType; 
import org.openqa.selenium.TakesScreenshot; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.ie.InternetExplorerDriver; 
import org.openqa.selenium.remote.DesiredCapabilities; 



public class Logon { 
    static String driverPath = "C:/Users/2172633/Selenium/"; 
    public WebDriver driver; 

    public void setUp() { 
     System.out.println("*******************"); 
     System.out.println("launching IE browser"); 
     System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe"); 
     driver = new InternetExplorerDriver(); 
     driver.manage().window().maximize(); 
    } 
    public static void main(String[] args) throws IOException { 
     Logon Logon = new Logon(); 
     Logon.setUp(); 
     DesiredCapabilities.internetExplorer(); 
    } 
    public void login(String userName, String Password) throws IOException { 
     driver.navigate().to("https://www.kroger.com/"); 
+0

我在做什麼錯?我嘗試了所有可以在Google上找到的解決方案。 –

回答

1

有你安裝了在Selenium中使用IE的額外Nuget包? 「Selenium.WebDriver.IEDriver」

+0

謝謝,但我其實只是想出了這個問題。 Incase其他人遇到這個問題與IE設置有關。您只需爲所有四個區域啓用保護模式。 –