2016-08-23 11 views
-2

私はセレンを学び始めて、今はubuntuの下でEclipseを使っています。 しかし、私の最初のプログラムドライバの実行ファイルへのパスを設定する手順は何ですか?

public class FirstTestCase { 

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

     // Create a new instance of the Firefox driver 
     WebDriver driver = new FirefoxDriver(); 

     //Launch the Website 
     driver.get("https://www.google.com"); 

     // Print a Log In message to the screen 
     System.out.println("Successfully opened the website https://www.google.com"); 

     //Wait for 5 Sec 
     Thread.sleep(5); 

     // Close the driver 
     driver.quit(); 
    } 
} 

を実行していると、私はこのエラーを持って、私はパスを設定する方法がわからないながら。私はgithubからgeckodriverの最新のlinux版をダウンロードし、それを私のデスクトップに置きます。あなたの助け

Exception in thread "main" java.lang.IllegalStateException: The path 
to the driver executable must be set by the webdriver.gecko.driver 
system property; for more information, see 
https://github.com/mozilla/geckodriver. The latest version can be 
downloaded from https://github.com/mozilla/geckodriver/releases 
     at com.google.common.base.Preconditions.checkState(Preconditions.java:199) 
     at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109) 
     at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:38) 
     at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:91) 
     at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296) 
     at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:245) 
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:220) 
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:215) 
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211) 
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:124) 
     at automationFramework.FirstTestCase.main(FirstTestCase.java:14) 

答えて

0

-D<name>=<value>がライン引数をコマンドに追加して[システムのプロパティを設定することができますいただきありがとうございます。

私が覚えている限り、runボタンの横にある小さな三角形を押すと、この引数を設定できます。

関連する問題