Phantom JS synchronous AJAX request : NETWORK_ERR: XMLHttpRequest Exception 101(Phantom JS 同步 AJAX 请求:NETWORK_ERR: XMLHttpRequest Exception 101)
问题描述
我正在进行同步 ajax 调用(ajax 设置 async: false ).这很好用.
I am making a synchronous ajax call ( ajax settings async: false ). This works well.
现在我正在尝试在 phantomJS 中为此编写一个自动化测试,但出现此错误
Now I'm trying to write an automated test for this in phantomJS and I'm getting this error
NETWORK_ERR: XMLHttpRequest Exception 101
我检查了我的服务日志,似乎服务没有收到任何请求.
I checked my service logs and it seems like service is not getting any request.
推荐答案
尝试在运行脚本时使用命令行选项 --web-security=no
禁用网络安全.(phantomjs --web-security=no yourscript.js
)
Try disabling the web security by using the command-line option --web-security=no
when running your script. (phantomjs --web-security=no yourscript.js
)
来自 PhantomJS 参考 (http://phantomjs.org/api/command-line.html):
From the PhantomJS reference (http://phantomjs.org/api/command-line.html):
"--web-security=[true|false]
启用网络安全并禁止跨域 XHR(默认为 true).也接受:[yes|no]代码>
"--web-security=[true|false]
enables web security and forbids cross-domain XHR (default is true). Also accepted: [yes|no]
这篇关于Phantom JS 同步 AJAX 请求:NETWORK_ERR: XMLHttpRequest Exception 101的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Phantom JS 同步 AJAX 请求:NETWORK_ERR: XMLHttpRequest Exception 101


基础教程推荐
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01