我在让Behat与Zombie.js一起工作时遇到了一个又一个问题。我现在遇到的问题实际上是在Zombie.js模块中(以前,错误出现在两者之间的链接中)。
错误看起来是这样的。
[RuntimeException]
Server process has been terminated: (8) [
url.js:107
throw new TypeError("Parameter 'url' must be a string, not " + typeof url)
^
TypeError: Parameter 'url' must be a string, not undefined
at Url.parse (url.js:107:11)
at urlParse (url.js:101:5)
at Object.urlResolve [as resolve] (url.js:405:10)
at History._resolve (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/history.coffee:201:20)
at History._assign (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/history.coffee:209:18)
at /Users/nathanielh/www/website/node_modules/zombie/lib/zombie/browser.coffee:326:30
at Browser.withOptions (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/browser.coffee:105:14)
at Browser.visit (/Users/nathanielh/www/website/node_modules/zombie/lib/zombie/browser.coffee:320:12)
at Socket.eval (eval at <anonymous> (/private/var/folders/fv/fp4xrfnx7kzfq2bqzywq5p9w00010f/T/mink_nodejs_serverSZBH0W:43:10), <anonymous>:2:9)
at Socket.<anonymous> (/private/var/folders/fv/fp4xrfnx7kzfq2bqzywq5p9w00010f/T/mink_nodejs_serverSZBH0W:43:5)
] 我发现在history.coffee中,resolve函数试图使用一个不存在的数组元素。
// history.coffee
_resolve: (url)->
if url
return URL.resolve(@_stack[@_index]?.url, url)
else # Yes, this could happen
return @_stack[@_index]?.url对@_stack[@_index]的引用解析为undefined,然后将其传递到导致错误的URL.resolve中。
你知道为什么会发生这种事吗?
更新
我注意到@_stack是空的,而@_index是-1。这应该是不可能的,对吧?
发布于 2013-08-01 07:23:32
僵尸驱动程序与节点版本0.8.24中断(0.8.23工作正常)。我相信这是由于变化:
2013.06.04, Version 0.8.24 (maintenance), c1a1ab067721ea17ef7b05ec5c68b01321017f05
* url: Properly parse certain oddly formed urls (isaacs)类似的更改(在同一天进行)似乎已经在0.10.10中进行了(尽管我没有直接研究提交)。
2013.06.04, Version 0.10.10 (Stable), 25e51c396aa23018603baae2b1d9390f5d9db496
* url: Properly parse certain oddly formed urls (isaacs)我建议恢复到0.8.23或0.10.9,以使其正常工作。如果您还没有使用它,我建议您使用nvm来管理您的节点安装。
发布于 2013-08-01 06:31:26
尝试使用Mink/Behat/Symfony2.1模拟$nodeElement->mouseOver()时出现相同的问题
TypeError: Parameter 'url' must be a string, not object
at Url.parse (url.js:107:11)
at urlParse (url.js:101:5)
at Object.urlResolve [as resolve] (url.js:405:10)
at Object.iframe.setAttribute (/usr/lib/node_modules/zombie/lib/zombie/jsdom_patches.js:164:43)
at attrCopy (/usr/lib/node_modules/zombie/node_modules/jsdom/lib/jsdom/level1/core.js:331:14)
at Object.core.Node.cloneNode (/usr/lib/node_modules/zombie/node_modules/jsdom/lib/jsdom/level1/core.js:636:18)
at Object.core.Node.cloneNode (/usr/lib/node_modules/zombie/node_modules/jsdom/lib/jsdom/level1/core.js:706:37)
at Function.jQuery.extend.clone (/js/2225e47_jquery-1.8.2_2.js:6222:17)
at Function.jQuery.extend.parseHTML (/js/2225e47_jquery-1.8.2_2.js:501:31)
at jQuery.fn.jQuery.init (/js/2225e47_jquery-1.8.2_2.js:131:24)
at jQuery (/js/2225e47_jquery-1.8.2_2.js:44:10)
in /js/45a7194_jquery.jqModal_9.js节点版本为v0.10.15。还在寻找答案。
https://stackoverflow.com/questions/17879557
复制相似问题