zoukankan      html  css  js  c++  java
  • 自动化测试selenium+java 环境搭建

    1.开发环境:

    a:安装jdk,配置java的环境变量

    b:安装eclipse 工具、火狐浏览器(低版本)

    2.下载selenium包

    selenium-java-2.44.0.jar

    selenium-server-standalone-2.45.0.jar

    selenium-java-2.44.0-srcs.jar

    3.打开eclipse ,将selenium包导入

    4.再编写代码

    import java.sql.Time;
    import java.util.concurrent.TimeUnit;
    import org.openqa.selenium.*;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.server.browserlaunchers.Sleeper;


    public class webdriverdemo {

    public static void main(String[] args) {

      System.setProperty("webdriver.firefox.bin", "D:\Program Files (x86)\Mozilla Firefox\firefox.exe");
      WebDriver driver = new FirefoxDriver();
      driver.get("https://www.baidu.com");

      WebElement text = driver.findElement(By.name("mobile"));
      text.sendKeys("百度");
      Sleeper.sleepTightInSeconds(1);
      text.submit();
    }

    }

     编写完后运行,能运行访问就ok了

      觉得不错的可关注微信公众号在手机上观看,让你用手机边玩边看

  • 相关阅读:
    CODEFORCES 429B 动态规划
    HDU 2084(DP)
    最大公约数算法(待续)
    spring---aop 配置
    代理模式
    spring--学习之IOC DI
    spring--基本介绍
    JAVASE 面试总结(1)
    工厂模式
    建造者模式
  • 原文地址:https://www.cnblogs.com/test-my/p/5941973.html
Copyright © 2011-2022 走看看