1. 程式人生 > >Mac下,eclipse初始化chrome瀏覽器driver的寫法

Mac下,eclipse初始化chrome瀏覽器driver的寫法

WebDriver driver;

System.setProperty("webdriver.chrome.driver","/Users/gehongna/appium/chromedriver");

driver = new ChromeDriver();

driver.get("http://www.baidu.com");

System.setProperty("webdriver.chrome.driver","/Users/gehongna/appium/chromedriver")這一行,我把Chrome driver驅動程式放在了專案的一個driver資料夾下,然後改寫為System.setProperty(

"webdriver.chrome.driver","driver/chromedriver")報錯,

The driver is not executable: /Users/gehongna/workspace/Demo1/driver/chromedriver

不可以這樣寫嗎?