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了

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

  • 相关阅读:
    js+分布上传大文件
    java+大文件断点续传
    word粘贴图片到ekitor
    ckeditor从word粘贴图片
    word粘贴图片到ckeitor
    2g 大文件上传
    php+大视频文件上传+进度条
    java+Word图片上传控件
    断点续传管理系统
    富文本编辑器粘贴复制Word
  • 原文地址:https://www.cnblogs.com/test-my/p/5941973.html
Copyright © 2011-2022 走看看