zoukankan      html  css  js  c++  java
  • 二、环境安装

    一.默认已经安装java环境、Intellij IDEA开发环境工具。
    二.安装Selenium
    1.安装java语言支持包

    2.下载Selenium server包,server包已经包含所有Selenium java版的包,所以此时只需要安装这两个jar包即可

    3.导入selenium-server-standalone-3.10.0.jar包,
    File->Project Structure->Modules->Dependencies标签处点击+ ->JARs or directories,选择对应jar包,点OK。

    4.下载浏览器驱动,这里我用的是火狐浏览器的驱动(与浏览器版本对应),需要翻墙。自行下载

    5.给出一个Demo,可以复制粘贴后,运行,查看是否存在问题

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class Baidu {
    public static void main(String[] args){
    WebDriver driver = new FirefoxDriver();
    driver.get("https://www.baidu.com");
    driver.findElement(By.id("kw")).sendKeys("java selenium");
    driver.findElement(By.id("su")).click();
    driver.quit();
    }
    }

    三、配置Maven
    已下载apache-maven,配置apache-maven-3.6.0conf 路径下的settings.xml文件
    line 55:本地仓库配置
    E:LSWorkToolsmy_local_repository
    line 159:由于源仓库访问速度过慢,这边配置阿里云国内代理服务器


    alimaven
    aliyun maven
    http://maven.aliyun.com/nexus/content/groups/public/

    *


    进入File->setting,按照图示配置

  • 相关阅读:
    SDOI2017遗忘的集合
    菜鸡的考场emacs配置
    SDOI2017苹果树
    SDOI2017硬币游戏
    都11点了为什么还没有人阿克离场
    TJOI2013数字根
    HNOI2018毒瘤
    闵可夫斯基和
    三维凸包学习小记
    灭绝树学习小记
  • 原文地址:https://www.cnblogs.com/surenliu/p/12330132.html
Copyright © 2011-2022 走看看