• selenium-java,selenium安装配置


    准备材料

    1.java jdk

    http://www.oracle.com/technetwork/java/javase/downloads/index.html

    2.开发工具

    https://www.eclipse.org/downloads/

    3.selenium jar包

    http://selenium-release.storage.googleapis.com/index.html(内容多,自己找到自己要的版本,附上截图正常需要的东西)

    4.浏览器驱动

    火狐驱动:https://github.com/mozilla/geckodriver/releases (selenium3以上版本)

    谷歌驱动:http://npm.taobao.org/mirrors/chromedriver(没有win64版泪奔)

    5.浏览器

    6.版本对应要求

    参考:http://www.cnblogs.com/yanzhe/p/7839604.html

    顺序

    1.安装配置Java环境(jdk,不会就百度吧)

    2.下载开发工具,写个helloword(不会就百度吧)

    3.配置user library,导入selelnium jar(不会就百度吧)

    4.写代码(附上一段最简单的main函数运行的selenium代码)

    public static WebDriver webDriver;

    public static void main(String[] args) {

    System.setProperty("webdriver.firefox.bin", "D:\firefox\firefox57\firefox.exe");//浏览器路径
    System.setProperty("webdriver.gecko.driver","D:\Configuration\geckodriver-v0.19.1-win64\geckodriver.exe");//浏览器驱动路径
    WebDriver = new FirefoxDriver();//
    WebDriver.manage().window().maximize();//浏览器最大化
    WebDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);//超时等待30秒
    WebDriver.get("https://www.baidu.com");//跳转链接
    WebDriver.close;//关闭

    }
  • 相关阅读:
    DebugView使用技巧
    网络抓包--Wireshark
    常用curl命令
    chrome.debugger
    修改php.ini 的timezone
    初识Elasticsearch,bulk 操作的遇到的那些事
    chrome 扩展 调试
    sqlite 时间戳转时间
    centos 升级sqlite3
    php 安装redis
  • 原文地址:https://www.cnblogs.com/yanzhe/p/7839893.html
Copyright © 2020-2023  润新知