2017-07-17 19 views
0

以下のコードを実行している間、私はorg.openqa.selenium.WebDriverException: unknown error例外を観察しています。:不明なエラー

単純なドライバ初期化コードを使用していても、なぜこのエラーが発生するのか理解できません。

私はEclipseの火星2.

を使用しています

私は、次のコードを使用:それを修正する方法に私を導いてください

import org.openqa.selenium.*; 
    import org.openqa.selenium.chrome.*; 

    public class APP { 

     public static void main(String[] args) 
     { 
      // TODO Auto-generated method stub 

      System.setProperty("webdriver.chrome.driver", "E:\\CDS\\Application\\chromedriver.exe"); 
      try { 
       WebDriver driver = new ChromeDriver(); 
       driver.get("http://www.google.com"); 
      } catch (Exception e) { 
       // TODO Auto-generated catch block 
       System.out.println(e); 
      } 
     } 
    } 

戻り値このエラー

enter image description here

を。

+0

クロムドライバのバージョンは2.30です。最新のクロムブラウザを使用していますか? –

+0

私はChrome Version 58.19.3029.110 –

+0

を使用しています。これは変です...コードはよさそうです。暗黙の待ち時間を追加して試してみることはできますか?また、chromedriver 2.29とcheck –

答えて

0

ChromeDriverがデフォルトChromeOptionsを使用することはできないようです。 以下のコードを使用してWebDriverを初期化することができます。

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.chrome.ChromeDriver; 
import org.openqa.selenium.chrome.ChromeOptions; 

    public class APP { 

     public static void main(String[] args) 
     { 
      // TODO Auto-generated method stub 

      System.setProperty("webdriver.chrome.driver", "E:\\CDS\\Application\\chromedriver.exe"); 
      try { 
       ChromeOptions options = new ChromeOptions(); 
       options.addArguments("--disable-notifications"); 
       WebDriver driver = new ChromeDriver(options); 
       driver.get("http://www.google.com"); 
      } catch (Exception e) { 
       // TODO Auto-generated catch block 
       System.out.println(e); 
      } 
     } 
    } 

は、私はそれがあなたのために働くかどうか、状況を知ってみましょう。

+0

です。WebDriver driver = new ChromeDriver(オプション)でも同じエラーが発生しました。 –

+0

必要なインポートのみをインポートしていますか。*を使用してインポートしていませんか? import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; –

+0

私はそれでも同じエラーをしました。 –

関連する問題