【问题标题】:Selenium testing with GeoLocate- FireFox keeps turning it off使用 GeoLocate 进行 Selenium 测试 - FireFox 一直将其关闭
【发布时间】:2013-11-19 17:46:30
【问题描述】:

我正在一个位置感知网站上运行测试。我可以告诉 Chrome 或 IE 始终允许对该页面进行地理定位,但一旦我关闭浏览器,Firefox 总是会忘记。

其他人遇到过这种情况吗?

【问题讨论】:

    标签: firefox selenium geolocation selenium-webdriver


    【解决方案1】:

    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) 构造函数来使用现有的配置文件。

    【讨论】:

    • 第一点对我有用!我做了: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("geo.prompt.testing", true); profile.setPreference("geo.prompt.testing.allow", true);
    猜你喜欢
    • 2011-03-27
    • 2011-03-28
    • 2011-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-15
    • 1970-01-01
    相关资源
    最近更新 更多