duanjia1870 2013-07-26 10:55 采纳率: 0%
浏览 44

与Behat和Mink的Zombie.js

I've been having problem after problem with getting Behat to work with Zombie.js. The problem I've got now is actually within the Zombie.js module (before, the errors were in the link between the two).

The error looks like so.

  [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)                                   
  ]                                                                                                                                                    

I've found that in history.coffee, the resolve function is trying to use an array element that doesn't exist.

  // history.coffee
  _resolve: (url)->
    if url
      return URL.resolve(@_stack[@_index]?.url, url)
    else # Yes, this could happen
  return @_stack[@_index]?.url

That reference to @_stack[@_index] resolves to undefined, which is then being passed into URL.resolve, which is then causing the error.

Any idea why this would happen?

Update

I've noticed that @_stack is empty, and @_index is -1. This shouldn't be possible, right?

  • 写回答

2条回答 默认 最新

  • douwu8060 2013-07-31 22:31
    关注

    Same issue when trying to simulate a $nodeElement->mouseOver() with Mink/Behat/Symfony2.1

    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
    

    Node version is v0.10.15. Still digging for answers.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line