2017-05-04 21 views
0

我有最新的硒,OSX和Safari瀏覽器版本,但我不能用這樣簡單代碼,打開Safari瀏覽器驅動程序:硒:SafariDriver在MacOSX上不開放塞拉利昂

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.safari.SafariDriver; 

public class SafariDriverDemo { 

public static void main(String[] args) throws InterruptedException { 
     WebDriver driver; 
     driver = new SafariDriver(); 

     String baseURL = "https://www.google.com"; 

     driver.get(baseURL); 
     Thread.sleep(3000); 

     driver.quit(); 
} 

} 
  • 我能得到什麼在控制檯如下:「密碼:密碼:密碼:」
  • 而且不管我寫什麼密碼,在控制檯顯示:Screenshot 2

這儘管已經使我「允許遠程自動化'。我試過授權從終端中的驅動通過鍵入「在/ usr/bin中/ safaridriver'and這是結果

Could not start server: must specify at least one configuration argument. 

Usage: safaridriver [options] 
-h, --help    Prints out this usage information. 
-p, --port    Port number the driver should use. If the server 
          is already running, the port cannot be changed. 
          If port 0 is specified, a default port will be used 

我不知道從這裏採取什麼行動,也許這個問題可以固定從控制檯。

+0

請提及實際版本號。 「最新」已於2017年5月4日發生變化。您的問題的答案也可能不同。 –

回答

1

嘗試運行/usr/bin/safaridriver -p 0