2013-11-15 37 views

回答

3

Firefox的Selenium驅動程序默認情況下似乎創建了a new, anonymous profile with each run。因此,您的設置不會持續,因爲它們將在運行後與配置文件一起丟棄。

您應該:

  • 設置您的FirefoxProfile例如使用.setPreference("geo.prompt.testing", true);.setPreference("geo.prompt.testing.allow", true);
  • 或使用上述偏好設置現有配置文件或明確允許您的網站。然後設置webdriver.firefox.profile Java系統屬性或使用public FirefoxProfile(File profileDir)構造函數來使用該現有配置文件。
+0

第一點爲我工作! 我做了: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference(「geo.prompt.testing」,true); profile.setPreference(「geo.prompt.testing.allow」,true); – Flyview