【发布时间】:2013-11-19 17:46:30
【问题描述】:
我正在一个位置感知网站上运行测试。我可以告诉 Chrome 或 IE 始终允许对该页面进行地理定位,但一旦我关闭浏览器,Firefox 总是会忘记。
其他人遇到过这种情况吗?
【问题讨论】:
标签: firefox selenium geolocation selenium-webdriver
我正在一个位置感知网站上运行测试。我可以告诉 Chrome 或 IE 始终允许对该页面进行地理定位,但一旦我关闭浏览器,Firefox 总是会忘记。
其他人遇到过这种情况吗?
【问题讨论】:
标签: firefox selenium geolocation selenium-webdriver
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 System 属性或使用public FirefoxProfile(File profileDir) 构造函数来使用现有的配置文件。【讨论】: