2012-02-19 43 views
0

就像它的标题说:Zombiejs browser.text方法返回整个文档

zombie = require "zombie" 
should = require "should" 
browser = new zombie.Browser(); 

describe "index", -> 
    describe "herp derp", -> 
    it "should display room input", (done) -> 
     browser.visit "http://localhost:3000/", (err, browser) -> 
     if err 
      throw err.message 
     browser.text('title').should.equal 'Welcome to Test!' 
     done() 

browser.text( '标题')返回整个页面的HTML。这发生在我尝试选择的任何元素上。有什么建议么?

+0

你试过打开另一个URL吗?如果是这样,你会看到整个页面吗? – 2012-02-19 16:53:57

回答

0

会发生什么事,如果你改变你的代码如下:

Browser = require "zombie" 
should = require "should" 


describe "index", -> 
    describe "herp derp", -> 
    it "should display room input", (done) -> 
     Browser.visit "http://localhost:3000/", (err, browser) -> 
     if err 
      throw err.message 
     browser.text('title').should.equal 'Welcome to Test!' 
     done()