Selenium自动化测试----视频学习笔记

Day01

1)背景

2)为什么需要自动化

    不能发现BUG,不会提升质量。只是限定于对老功能发现问题。

3)原理介绍

    QTP:商业工具,笨重但是功能强大

    Selenium2:轻量级,需要一定编程基础

4)环境配置

    JDK安装

    eclipse

    testNg安装

    firefox32.0: 不自动更新 添加firebug firepath

5)其他工具

Day02

启动浏览器

1)启动Firefox

2)启动Chrome

3)启动IE

代码:

package webDriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class test {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
	public static void firefox(){
		WebDriver d = new FirefoxDriver();
		Navigation nav=d.navigate();
		nav.to("http://www.baidu.com");
		d.close();
		d=null;
	}
	public static void chrome(){
		System.setProperty("webdriver.chrome.driver", "file/chromedriver.exe");
		WebDriver d=new ChromeDriver();
		Navigation nav=d.navigate();
		nav.to("http://www.baidu.com");
		d.close();
		d=null;
	}
	public static void IE(){
		System.setProperty("webdriver.ie.driver", "file/IEDriverServer.exe");
		WebDriver ie=new InternetExplorerDriver();
		Navigation nav=ie.navigate();
		nav.to("http://www.baidu.com");
		ie.close();
		ie=null;
	}

}


本文出自 “ehealth” 博客,谢绝转载!

你可能感兴趣的:(测试)