---
title: "selenium + testng + grid 例子"
author: "jerome_wang"
date: "2015-07-30T15:05:00Z"
tags: []
categories: ["行业应用"]
slug: "selenium-testng-grid"
draft: false
lastmod: "2015-07-30T15:05:00Z"
id: 2231619
url: "https://jerome-wang.iteye.com/blog/2231619"
---

环境准备

TestNG + Grid + Webdriver

1.启动Grid hub + node

  hub端：

`java -jar selenium-server-standalone-2.4x0.jar -role node -hub`

 Node 端

`java -jar selenium-server-standalone-2.4x0.jar -role webdriver -hub http://hubIP:port/grid/register -port 5555`

 

 

`2.测试代码如图`

![](http://dl2.iteye.com/upload/attachment/0110/5761/a32a7144-5fc4-3d50-a559-ea8dc32db66c.png)  
 

3.TestNG配置如图

![](http://dl2.iteye.com/upload/attachment/0110/5759/ea3f2931-1f66-34fe-93e3-160ea8cf5992.png)  
 

4.结果如图

![](http://dl2.iteye.com/upload/attachment/0110/5763/fd0439a0-9f4b-34c9-983c-326814f778eb.png)