2012-09-26 52 views
3

我有測試過的web應用程序。我需要使用Firefox 5從Lunix和Windows進行測試。那麼,我怎樣才能在Firefox 5的新FirefoxDriver()中設置特定的Firefox版本,而不是Firefox 6或9? 我不想設置路徑到Firefox,因爲它不是有用的方法,當我們有幾個操作系統。如何在Selenium Webdriver中設置特定的Firefox版本?

回答

2

創建一個firefox 5配置文件,並在下面給出該配置文件的名稱。它將啓動給定的配置文件瀏覽器。

FirefoxProfile profile = new ProfilesIni().getProfile(profileName); 
DesiredCapabilities dc = DesiredCapabilities.firefox(); 
dc.setCapability(FirefoxDriver.PROFILE, profile); 
driver = new FirefoxDriver(dc); 

請參閱本link知道如何創建Firefox配置文件。

相關問題