用量角器设置火狐配置文件 [英] Set firefox profile with protractor
问题描述
我想使用禁用缓存功能的Firefox /量角器运行测试。
(其实,我试图阻止304 HTTP响应)。
有多种方法可以做到这一点:$ b
$ b
- 通过删除Etag头来禁用后端的缓存 - >我无法修改后端
- 将Etag头从前端 - >我试过了,它没有工作
- 从Firefox禁用缓存:我只需要设置标志
network.http.use-cache
为false
手动运行。我只收到200个回复,这很好。
我希望能够通过量角器配置来设置此标志。经过一番搜索后,我发现我必须创建一个自定义配置文件,并将其设置为量角器( https://code.google.com/p/selenium/wiki/DesiredCapabilities ):
功能: {
browserName:'firefox',
firefox_profile:'support / firefox_profile'
}
问题是没有考虑到firefox配置文件。这是正确的选择吗?
您有更好的主意吗?
感谢您的帮助。
编辑:
作为某人(建议
能力:{
prefs:{
'config.http.use -cache':false
}
}
不起作用 - I
如何知道你可以在这个功能中传递什么选项?
以下是如何将firefox-profile与量角器集成的示例: https://github.com/juliemr/protractor-demo/tree/master/howtos/setFirefoxProfile
编辑:对于那些升级到量角器> = 1.6 ,这样做的旧方式被打破,因为浏览器不能再返回一个承诺。演示已经更新。
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:
- 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
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'
}
The problem is that the firefox profile is not considered. Is it the right option? Do you have a better idea?
Thanks for your help.
EDIT: As someone (suggested
capabilities: {
prefs: {
'config.http.use-cache': false
}
}
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?
Here's an example of how to integrate firefox-profile with protractor: https://github.com/juliemr/protractor-demo/tree/master/howtos/setFirefoxProfile
EDIT: 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.
这篇关于用量角器设置火狐配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!