如何使用selenium webdriver打开特定的浏览器 [英] How to open specific browser using selenium webdriver

查看:822
本文介绍了如何使用selenium webdriver打开特定的浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用lang:java framework:testNG

I am using lang :java framework: testNG

我的系统安装了3-4个版本的Mozilla,我怎样才能打开Mozilla特定版本的实例。假设我安装了3.5,3.6,....版本的Mozilla,我想打开3.6版本并执行我的测试。

my system has 3-4 versions of Mozilla installed, how can i open instance of specific version of Mozilla. Suppose i have 3.5, 3.6,.... version of Mozilla installed and I want to open 3.6 version and perform my testing.

推荐答案

只需指定版本二进制文件的路径即可。例如 -

Just specify the path to the binary of the version..may be, like-

FirefoxBinary binary = new FirefoxBinary(new File("path_to_bin"));
FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(binary, profile);

这篇关于如何使用selenium webdriver打开特定的浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆