首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Mac上配置 Selenium Webdriver

Mac上配置 Selenium Webdriver

作者头像
用户9127725
发布2022-08-08 08:32:44
发布2022-08-08 08:32:44
1.4K0
举报

确认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://mybank.cn/index.htm");

        //webDriver.close();

    }

}

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016-11-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档