分享

Mac上配置 Selenium Webdriver

 看见就非常 2020-05-13
确认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();
    }
}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多