确认Chrome的安装路径 Terminal 执行命令 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome 应当能够正常启动Chrome浏览器。 如果没有,需要 ln -s 创建 Google Chrome 二进制命令的软连接,或者 reinstall 将chromedriver放在 /usr/bin目录 官网下载地址,下载后执行 sudo cp ~/Downloads/chromedriver /usr/bin/ 或者直接执行 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> 启动测试 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(); } }
|
|