---
title: "selenium grid"
author: "toolkit1216"
date: "2011-06-23T15:55:35Z"
tags: ["Ant", "Apache", "Firefox", "JDK", "浏览器"]
categories: ["企业架构"]
slug: "selenium-grid"
draft: false
lastmod: "2011-06-23T15:57:34Z"
id: 1102588
url: "https://toolkit1216.iteye.com/blog/1102588"
---

一 ant安装
1、下载安装 ant apache-ant-1.8.2-bin.zip

2、 解压包到你选择的任意目录，

3、 建立环境ANT_HOME=你的解压路径/apache-ant-1.8.2/
4、 设置path路径 path=%ANT_HOME%/bin 
5、检查ant安装情况  ant -version

二 jdk安装
1、下载jdk1.6版本
2、 建立环境JAVA_HOME=你的安装路径/jdk1.6/
4、 设置path路径 path=%JAVA_HOME%/bin 
5、检查ant安装情况  JAVA -version

三 selenium grid 安装
1、下载selenium grid 
2、解压缩 selenium grid 
3、进入到解压缩后的selenium grid目录下  执行ant sanity-check
4、运行selenium grid 执行命令： ant launch-hub
5、检查是否启动成功。测试地址   http://localhost:4444/console

6、需要配置多个端口的selenium rc
ant -Dport=&lt;rcport&gt;  设置端口
    -Dhost=&lt;rchost&gt;  设置不同机器的ip
    -DhubURL=http://&lt;hubhost&gt;:4444 访问地址
    -Denvironment="*firefox" 浏览器类型指定
    launch-remote-control  发起远程控制命令
例子1：
 假如你的selenium hub是在10.38.128.128上，而实际要注册的selenium rc是在
10.38.128.197上并且端口是5555。

ant -Dport=5555
    -Dhost=10.38.128.197
    -DhubURL=http://10.38.128.128:4444
    -Denvironment="*firefox"
    launch-remote-control

例子2：
   假如你想实现在同一机器上，开启不同的端口的selenium rc 则使用方式如下
   ant -Dport=8888 -Denvironment="*firefox" launch-remote-control	  &lt;/hubhost&gt;&lt;/rchost&gt;&lt;/rcport&gt;