如何在Selenium Webdriver中设置特定的Firefox版本? [英] How to set particular Firefox version in Selenium Webdriver?
本文介绍了如何在Selenium Webdriver中设置特定的Firefox版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不想设置firefox的路径,因为当我们有几个操作系统的时候没有用的方法。 创建一个firefox 5配置文件,并给出下面的配置文件的名称。它将启动给定的配置文件浏览器。
FirefoxProfile配置文件= new ProfilesIni()。getProfile(profileName);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE,profile);
driver = new FirefoxDriver(dc);
请参阅链接了解如何创建Firefox个人资料。
I have web app under tests. And I need to test it from Lunix and Windows with firefox 5 only. So, how can I set particular firefox version in New FirefoxDriver() that Firefox 5 runs only, not Firefox 6 or 9? I don't want to set path to firefox because it's not useful approach when we have several OS.
解决方案
Create one firefox 5 profile and just give the name of that profile below. It will launch the given profile browser.
FirefoxProfile profile = new ProfilesIni().getProfile(profileName);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, profile);
driver = new FirefoxDriver(dc);
refer this link to know how to create firefox profile.
这篇关于如何在Selenium Webdriver中设置特定的Firefox版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文