2013-11-15 36 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