【发布时间】:2016-03-17 19:35:16
【问题描述】:
目前我正在尝试(强制)使用量角器访问文件作为网站(html 文件)。当我尝试这样做时,量角器出现错误,内容如下:
Failed: Access to 'file:///C:/filelocation/index.html' from script denied
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'BAHCND4397GQF', ip: '10.138.1.189', os.name: 'Windows 7', os.arch: 'amd64',os.version: '6.1', java.version: '1.8.0_72'
Driver info: driver.version: unknown
在互联网上搜索解决方案后,我发现问题是 Firefox 问题,添加的简单说明:
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "C:/MendisSoftwareList/Software%20List/cwmdt-applications-parent/common-parent/index.html");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
到“user.js”文件。经过更多研究,我发现此文件必须位于我尝试使用的 Firefox 配置文件中,我已将其放置在以下位置:
C:\Users\userName\AppData\Roaming\Mozilla\Firefox\Profiles\Profile
无济于事。坦率地说,我没有想法。任何帮助,将不胜感激。 这是我的资源列表:
https://groups.google.com/forum/#!msg/selenium-users/Guh9x4HEWls/pbEjrsq5pXUJ
http://kb.mozillazine.org/User.js_file
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/6373
提前致谢。
【问题讨论】:
-
你的意思是你需要用firefox打开你的url?如果然后尝试功能:{ browserName:'firefox',}
-
我目前正在使用 Firefox,我的浏览器确实可以使用它打开。但是它会立即崩溃。
标签: javascript selenium firefox jasmine protractor