2013-06-12 33 views
3

我無法找到Firefox的配置文件路徑的路徑,我使用如何使用webdriver的

static String HubHost; 

static String HubPort; 
HubHost=java.net.InetAddress.getLocalHost().getCanonicalHostName().toString().trim(); 

HubPort = "4444"; 

FirefoxProfile profile = new FirefoxProfile(); 

DesiredCapabilities dc = DesiredCapabilities.firefox(); 

profile.setAssumeUntrustedCertificateIssuer(false); 

dc.setCapability(FirefoxDriver.PROFILE, profile); 

System.out.println("Profile name:"+profile.layoutOnDisk().); 

URL grid_url=new URL("http://"+HubHost+":"+HubPort+"/wd/hub"); 

webdriver = new CustomRemoteWebDriver(grid_url,dc); 

String suggestedProfile = System.getProperty("webdriver.firefox.profile"); 

System.out.println("Profile name:"+ suggestedProfile); 

一個新的配置文件在TEMP文件夾中生成以下代碼找到Firefox的配置文件路徑名稱如「anonymous651976431316177878webdriver-profile」,但無法通過代碼獲取該名稱。

任何幫助將不勝感激。

+1

你想知道新的配置文件的*臨時*路徑爲什麼,因爲它將在WebDriver會話完成後被刪除? – bbbco

+0

我想更改CERT8.db文件中的數據,該文件將處理瀏覽器SSL證書和Cookie – user2477308

+0

您打算如何處理SSL證書和Cookie?在初始化瀏覽器之前,WebDriver已經在瀏覽器的Profile配置中集成了很多這些類型的scenerios。我建議首先檢查:https://code.google.com/p/selenium/wiki/RubyBindings#SSL_Certificates – bbbco

回答

0

之前試圖讓系統屬性「webdriver.firefox.profile」你莫名其妙應該設置它。 你能提供的輸出:

System.out.println("Profile name:"+ suggestedProfile); 

如果您還沒有設置該系統屬性,是應打印:

Profile name:null 
+2

嗨, 當我打印 System.out.println(「配置文件名稱:」 + suggestedProfile); 在TEMP目錄中創建一個新文件夾,並在名爲「anonymous651976431316177878webdriver-profile」的d控制檯中進行打印。 對我來說,我需要進行設置 系統屬性「webdriver.firefox.profile」這樣 我需要創建出設置配置文件路徑默認的配置文件,並需要訪問配置文件路徑來訪問配置文件路徑。 謝謝 – user2477308