確認(rèn)Chrome的安裝路徑 Terminal 執(zhí)行命令 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome 應(yīng)當(dāng)能夠正常啟動(dòng)Chrome瀏覽器。 如果沒有,需要 ln -s 創(chuàng)建 Google Chrome 二進(jìn)制命令的軟連接,或者 reinstall 將chromedriver放在 /usr/bin目錄 官網(wǎng)下載地址,下載后執(zhí)行 sudo cp ~/Downloads/chromedriver /usr/bin/ 或者直接執(zhí)行 brew install chromedriver 記得加上依賴 <dependency> <groupId>com.alipay.autotest.ats</groupId> <artifactId>ats-webui</artifactId> <version>2.4.5</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.39.0</version> </dependency> 啟動(dòng)測(cè)試 package com.alipay.ats.testcase.webui; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; /** * Chrome launch Test * Created by fish on 14/09/15. */ public class ChromeTest { public static void main(String[] args) { WebDriver webDriver = new ChromeDriver(); webDriver.get("https:///index.htm"); //webDriver.close(); } }
|
|