Grid的安装与使用一

  • 简介

  Selenium Grid是一种自动化的测试辅助工具,Grid通过利用现有的计算机基础设施,能加快Web-app的功能测试。利用Grid,可以很方便地同时在多台机器上和异构环境中并行运行多个测试事例。  Selenium Grid基于Web-app测试工具Selenium,它可以让您同时并行运行多个Selenium Remote Control。比较好的一点事,它使所有这些Selenium Remote Control显示为一个,这样您在测试中就可以不必操作具体的计算机。  Selenium Grid因为是基于Selenium RC的,所以它同时支持RC的其它所有语言,如:Ruby, Java, Python, C#, PHP, …  还有最后一点,Selenium Grid简单易用。

  • 原理图

  • 使用

  下面,我们就介绍下如何使用Selenium Grid。

  •  准备:
  1. 下载安装ant

  http://apache.mirrormax.net/ant/binaries/apache-ant-1.7.0-bin.zip  解压包到你选择的任意目录,然后将 你的解压路径/apache-ant-1.7.0/bin 添加的Path变量中。  最后验证安装:  java -version  java version “1.6.0”  Java(TM) SE Runtime Environment (build 1.6.0-b105)  Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)

  1. 下载Selenium Grid

  http://selenium-grid.seleniumhq.org/download.html  其中,zip是Windows平台的,tar.bz2用于其他平台。下载后解压缩,然后验证:  ant sanity-check

  • 运行:

 在Selenium2.0之前,Selenium Grid是独立提供服务的。自2.0之后,Selenium Grid被集成到了Selenium Server中了(包含在selenium-server-standalone-.jar中)。Starting a Hub

To start a hub with default parameters, run the following command from a command-line shell. This will work on all the supported platforms, Windows Linux, or MacOs.

java -jar selenium-server-standalone-2.21.0.jar -role hub

This starts a hub using default parameter values. We’ll explain these parameters in folowing subsections. Note that you will likely have to change the version number in the jar filename depending on which version of the selenium-server you’re using.Starting a Node

To start a node using default parameters, run the following command from a command-line.

java -jar selenium-server-standalone-2.21.0.jar -role node -hub http://localhost:4444/grid/register

This assumes the hub has been started above using default parameters. The default port the hub uses to listen for new requests is port 4444. This is why port 4444 was used in theURL for locating the hub. Also the use of ‘localhost’ assumes your node is running on the same machine as your hub. For getting started this is probably easiest. If running the hub and node on separate machines, simply replace ‘localhost’ with the hostname of the remote machine running the hub.

WARNING: Be sure to turn off the firewalls on the machine running your hub and nodes. Otherwise you may get connection errors.

  • 使用Selenium Grid与普通的Selenium Server的区别在于是否带上了-role参数。

# 启动Selenium Serverjava –jar selenium-server-standalone-2.22.0.jar -port 4444 # 启动Selenium Grid的Hubjava –jar selenium-server-standalone-2.22.0.jar -port 4000 -role hub

# 启动Selenium Grid的Node,其中的-hub参数,是Selenium Grid的Hub的URLjava -jar selenium-server-standalone-2.22.0.jar -port 4001 -role node -hubhttp://127.0.0.1:4000/grid/register

#显然,可以启动多个Node:java -jar selenium-server-standalone-2.22.0.jar -port 4002 -role node -hubhttp://127.0.0.1:4000/grid/register

java -jar selenium-server-standalone-2.22.0.jar -port 4003 -role node -hub http://127.0.0.1:4000/grid/register

……例如,

  1. hub:
  2. node:

  通过浏览器访问Selenium Grid控制台验证Selenium Grid启动成功:  http://localhost:4444/console

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本课程是分布式集群自动化测试高阶框架的基础实战课。课程内容是基于CI/CD/DevOps的核心模块进行框架的开发讲解。是DevOps发包框架高阶实战的必备知识。老师从多角度、多层次、多维度基于Demo进行迭代讲解,做到认真细致讲好课程的每一要点。全方位助力学员掌握发包高阶框架开发的必备知识,快速领悟发包模块开发的技术要领。 主讲老师为资深高级技术专家。毕业于电子科技大学。先后工作于多家知名外企,知名通信民企,知名IT公司。◇ 具备区块链领域高级测试解决方案设计、专家级测试开发、团队管理培训经验。◇ 具备专家级自动化测试解决方案、自动化测试平台框架设计开发、自动化测试团队管理培训经验。◇ 具备专家级的功能专项测试、性能专项测试经验及丰富的渗透测试经验。◇ 具备丰富的持续集成/持续交付(CI/CD)开发、实施及运维经验。◇ 具备丰富的C#/Java/Delphi/VB/C++/Python/Tcl/Groovy/Shell等开发及脚本开发经验◇ 具备20年的IT互联网工作经验。先后担任过项目经理,测试技术经理,测试总监以及专家级技术顾问等职务。独立开发完成有如下自动化测试框架及平台◇ GUI自动化测试框架(TSL)◇ ATF自动化测试框架(Tcl/Tk)◇ ATP自动化测试平台(C#/Java)◇ SoapUI接口自动化测试框架(Groovy/华为)◇ 持续集成自动化打包框架(Java/华为)◇ 区块链性能测试框架(Python)等。擅长框架/平台设计开发、团队管理、团队技能提升培训,技术瓶颈突破等。
神级编辑器,就是excel与Python的结合,使得简单的UI与Python编程语言结合起来简直不要太好用,下载安装配置的时候容易出错,根据自己的犯错经验写了个详细的教程,方便大家使用下载避免走弯路犯错。 1、 Windows 环境下使用Docker安装gridstudio教程 (1) 下载Grid Studio,一个是保存到桌面的GitHub Desktop;一个下载的文件夹,最好放在C盘根目录,方便后面在Git Bash里cd 到C盘后,用cd gridstudio && ./run.sh来启动Gridstudio; (2) 安装Git Bash,就是相当于GitHub命令行 (3) 下载Docker,第一次在官网下载,需要先在Docker官网注册一个账号;开启电脑虚拟化,性能->CPU,虚拟化启用;启用或关闭Windows功能->把Hyper-v勾上;然后重启。然后安装Docker,磁盘共享设置C盘,输入电脑账号密码,重启即可。在cmd 输入 docker –version 看看是否安装成功。 (4) 双击打开Git base ,将目录切换到C盘根目录,$ cd C: 然后执行命令 $ cd gridstudio-master && ./run.sh (5) 然后脚本会下载一些文件,知道提示完成,并且给出访问地址:http://127.0.0.1:8080即表示编译成功。 (6) 可以访问上面的地址了,输入用户名密码:admin/admin即可操作这个工具了。 (7) 运行过一次,下次再启动 1,$ cd C: 2,$ cd gridstudio-master 3,$ ./destroy.sh 4,./run.sh 就可以了。 (8) 安装的过程中Docker可能会出现一些错误,关闭防火墙,关闭360安全卫士,重启电脑!!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值