TestNG实现远程执行火狐浏览器
Hub机器输入
java -jar selenium-jar-statnjld.jar -role hub
Node机器输入:
java -jar sel....... -role webdriver -hub 主机:4444/gird/register -port 6655
注意:火狐版本不要处于加载插件中,尽量版本不要太高
package com.gloryroad.remote;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.os.WindowsUtils;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.sun.jna.platform.unix.X11.Window;
public class TestSeleniumGrid {
WebDriver driver;
public static String baseUrl="http://www.baidu.com";
public static String nodeUrl="http://192.168.0.103:6655/wd/hub";
@BeforeMethod
public void setUp() throws MalformedURLException, InterruptedException{
//设定远程节点的操作系统和浏览器,需要设定DesiredCapabilities.
DesiredCapabilities des=DesiredCapabilities.firefox();
//设定远程浏览器的名称
des.setBrowserName("firefox");
//设定远程的操作系统平台
des.setPlatform(Platform.XP);
Thread.sleep(5000);
//使用RemoteWebDriver对象生成一个远程连接的Driver
driver=new RemoteWebDriver(new URL(nodeUrl), des);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20000, TimeUnit.SECONDS);
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
@Test
public void testSearch()
{
for (int i = 0; i <4; i++) {
driver.get(baseUrl);
driver.get("http://sogou.com");
driver.navigate().back();
driver.get(baseUrl);
}
}
}
TestNG实现远程执行火狐浏览器相关推荐
- CentOS 6.8 安装TigerVNC 实现 Linux 远程桌面并安装火狐浏览器
CentOS 6.8 安装TigerVNC 实现 Linux 远程桌面并安装火狐浏览器 vnc客户端地址:https://files.cnblogs.com/files/MYSQLZOUQI/vnc- ...
- 火狐浏览器不执行alert的问题
由于浏览器自带滚动条呈现比较不理想,于是做一个touch模拟滚动条函数的封装,在使用alert()函数检测到达底部或者顶部时,在谷歌,IE均正常使用,但是在火狐测试时出现alert()不执行的情况,尝 ...
- 火狐浏览器服务器意外响应,Firefox 火狐浏览器 83 发布,已修复任意代码执行漏洞...
火狐浏览器 (Mozilla Firefox)是 Mozilla 基金会的产品 , 它是一款开源 Web 浏览器 , 引擎反应快 , 内存占用少.Firefox 从 2005 年开始,每年都被媒体选为 ...
- ie浏览器修复_腾讯安全:IE浏览器曝远程执行代码漏洞 腾讯安全强势推出漏洞修复工具...
近日,微软发布一例远程执行代码漏洞(CVE-2019-1367)漏洞修复补丁,攻击者可利用网页挂马和邮件进行攻击,得手后获取用户权限,控制大量系统,造成严重影响.腾讯安全团队自该漏洞安全公告发布之后, ...
- 迅雷插件使得火狐浏览器带参数连接执行了两遍Action
今天用ssh框架写一个删除数据库数据的代码,Action定义如下: @Action(value="/admin/deleteExam", results={@Result(name ...
- H3C SecParh堡垒机任意用户登录与远程执行代码漏洞
H3C SecParh堡垒机任意用户登录与远程执行代码漏洞 1.H3C SecParh堡垒机任意用户登录漏洞 1.1.漏洞描述 1.2.漏洞影响 1.3.漏洞复现 1.3.1.登录页面 1.3.2.构 ...
- 执行远程linux命令,linux shell 远程执行命令
经常要部署多台服务器上面的应用,如果一个个机器的登录太麻烦. 所有就想到编写一个脚本来部署不同的服务器 前提条件: 配置ssh免登陆 如果不会的请参加我的另外一篇文章 http://blog.csdn ...
- linux火狐浏览器49.0安装教程,firefox for linux
火狐浏览器是一款免费开源的跨平台浏览器,firefox for linux引入了扩展同步机制用户能够在家用电脑和办公电脑之间进行无缝同步,能给用户更为流畅和高速的上网浏览体验,同时也让开发者能够开发出 ...
- 哪款浏览器好用_碉堡了!火狐浏览器发布重大更新,谷歌Chrome请hold住!
萝卜哥经常被网友问及一个问题,那就是"Firefox和Chrome哪款浏览器更好用?" 其实萝卜哥也很难回答出到底哪款更好用,莎士比亚说过一句话:"一千个观众眼中有一千个 ...
最新文章
- Python 爬虫实例(1)—— 爬取百度图片
- Linux dmesg 命令学习
- java后台接收数据格式_Java后台基于POST获取JSON格式数据
- 提取点的dn值_干货在线 | DEM数据如何生成高程点
- 音视频技术开发周刊 | 171
- 论文浅尝 | 使用位置敏感的序列标注联合抽取实体和重叠关系
- spring中context:property-placeholder标签详解
- Android 系统(189)---Android Handler:这是一份 全面、详细的Handler机制 学习攻略
- 软考信息安全工程师好考吗?
- 360se html怎么删除,360安全浏览器服务组件能删除吗 如何删除
- Ubuntu学习笔记(2)---安装LumaQQ
- Linux消息队列实现进程间通信
- 网易校招笔试第三题匈牙利算法
- C++ 排列组合问题
- samtools depth 用于外显子未覆盖区域的统计及统计未覆盖区域的意义
- c语言中puts的作用,c语言puts函数用法是什么?
- 利用outlook邮箱申请teams账号
- 【DataWhale学习】Day10~13-4章决策树——西瓜书学习摘录笔记
- 麻将胡牌递归算法(lua)
- C++: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]