使用量角器设置 Firefox 配置文件 [英] Set firefox profile with protractor

查看:28
本文介绍了使用量角器设置 Firefox 配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在禁用缓存功能的情况下使用 Firefox/量角器运行测试.(实际上,我正在尝试阻止 304 HTTP 响应).

I want to run tests with Firefox/protractor with the cache feature disabled. (Actually, I'm trying to prevent 304 HTTP responses).

有多种方法可以做到这一点:

There are multiple ways to do this:

  • 通过删除 Etag 标头从后端禁用缓存 -> 我无法修改后端
  • 从前端删除 Etag 标头 -> 我试过了,它不起作用
  • 从 Firefox 中禁用缓存:我只需将标志 network.http.use-cache 设置为 false
  • Disable the cache from the backend-side by droping Etag headers -> I can't modify the backend
  • Drop the Etag header from the frontend-side -> I tried, it did not work
  • Disable the cache from firefox: I just have to set the flag network.http.use-cache to false

手动操作.我只收到 200 条回复,这很棒.我希望能够通过量角器配置来设置这个标志.经过一番搜索,我发现我必须创建一个自定义配置文件并以这种方式在量角器中设置它(https://code.google.com/p/selenium/wiki/DesiredCapabilities):

Manually it works. I receive only 200 responses and it's great. I want to be able to set this flag through protractor configuration. After some search I found out that I had to create a custom profile and set it in protractor this way (https://code.google.com/p/selenium/wiki/DesiredCapabilities):

capabilities: {
   browserName: 'firefox',
   firefox_profile: 'support/firefox_profile'
 }

问题是没有考虑firefox配置文件.这是正确的选择吗?你有更好的主意吗?

The problem is that the firefox profile is not considered. Is it the right option? Do you have a better idea?

感谢您的帮助.

作为某人(建议

capabilities: {
  prefs: {
    'config.http.use-cache': false
  }
}

它不起作用 - 我检查了 about:config,该标志仍​​然启用.您如何知道可以在功能中传递哪些选项?

It did not work - I checked in about:config, the flag was still enabled. How do you know what options you can pass in the capabilities?

推荐答案

下面是一个如何将 firefox-profile 与 protractor 集成的示例:https://github.com/juliemr/protractor-demo/tree/master/howtos/setFirefoxProfile

Here's an example of how to integrate firefox-profile with protractor: https://github.com/juliemr/protractor-demo/tree/master/howtos/setFirefoxProfile

对于那些升级到量角器 >=1.6 的人,这样做的旧方法被打破了,因为浏览器"不能再返回一个承诺.演示已更新.

For those upgrading to protractor >=1.6, the old way of doing this was broken because 'browser' can no longer return a promise. The demo has been updated.

这篇关于使用量角器设置 Firefox 配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆