用Selenium IDE 在firefox中录制脚本,生成相应的代码,可以是java C# Ruby Python
用Selenium RC 运行脚本,可以实现在不同的环境,不用的浏览器中进行自动化测试。
一 Selenium IDE 安装
安装firefox
下载Selenium IDE 插件 selenium-ide-1.0.12.xpi
http://seleniumhq.org/download/
将selenium-ide-1.0.12.xpi拖到firefox浏览器,提示安装,然后重启。
在菜单栏 工具 中,可以看到selenium IDE
二 Selenium RC 安装
在Eclipse 里用JUnit运行脚本,这里需要安装RC的服务器和相关的jar包。
1.RC服务器:Selenium Server selenium-server-standalone-2.0rc3.jar
下载地址:
http://seleniumhq.org/download/
最新版的selenium-server-standalone-2.0rc3.jar 只支持1.6的JDK
用命令行进入jar包的目录,执行命令
java -jar selenium-server-standalone-2.0rc3.jar
可以直接在jar包的目录写一个bat方便启动
@java -jar selenium-server-standalone-2.0rc3.jar
如果JDK的版本不是1.6,这里的RC服务器需要找老版本的jar包
selenium-remote-control-1.0.3.zip
下载地址:
http://code.google.com/p/selenium/downloads/list
2. JUnit需要用到的JAR包 selenium-java-2.0rc3.zip
下载地址:
http://seleniumhq.org/download/
在项目中导入解压后的jar包
三 selenium hello world
用Selenium IDE录制打开google 搜索selenium HelloWorld的脚本
导出java代码
package com.example.tests;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
public class seleniumTest extends SeleneseTestCase {
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com.hk/");
selenium.start();
}
@Test
public void test() throws Exception {
selenium.open("http://www.google.com.hk/");
selenium.type("q", "selenium HelloWorld");
selenium.click("btnG");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
打开Eclipse,新建一个java project - JUnit测试
启动Selenium RC服务器
运行seleniumTest.java
如果出现错误,如下,只需要把进程中的iexplore.exe全部结束,重新运行即可。
分享到:
相关推荐
selenium__RC__java环境配置.doc
手把手__SELENIUM_JAVA搭建_总结汇总篇
该jar包主要是selenium+java 进行自动化学习时的seleniumjar包,可直接导入java项目中进行引用
模数介绍rModulo de introduccion a SeleniumWebDriver_driver_驱动_下载
Selenium_IDE 火狐资源安装插件;Selenium_RC自动化功能测试插件
手把手__SELENIUM_JAVA搭建_总结篇.docx
Selenium 不同于一般的测试工具。一般的脚本测试工具录制脚本,实际上都是通过拦截 浏览器收发的http 请求来实现的。事实上并没有办法录制用户对html 页面的操作。 当然,对那些执行压力测试的工具来说,这类模拟...
Selenium webdriver_python_环境搭建 包括windows,Linux
python库。 资源全名:selenium_driver_updater-3.9.0.tar.gz
selenium IDE 火狐 插件 版本3.11 亲子测试 在火狐 67版本 可用
selenium-java-2.42.2.jar selenium-server-standalone-2.42.2.jar
selenium 这是一款基于selenium平台的测试用框架,selenium server为webdriver主框架,可以用来做自动化测试
我的测试项目Selenium_Java_framework_auto_wordpress
基于Selenium WebDriver的B_S架构软件的自动化测试研究.rar
基于Selenium WebDriver的B_S架构软件的自动化测试研究.pdf
Selenium_v2.5 Selenium_v2.5 Selenium_v2.5 Selenium_v2.5Selenium_v2.5 Selenium_v2.5
Selenium2.46 完整包,包含Selenium For Java And DoNet
Selenium WebDriver 学习笔记 API大全 中文API 元素 操作大全
Selenium python之学习笔记,便于Python初学者,欢迎下载
比如有公共的登录准备,就用这个bat吊起chrome后先手动完成一次登录,接下来在selenium脚本中可以接续你的手动页面进行接下去的操作,只需要在吊起selenium时进行如下配置: options.add_experimental_option('...