2012-02-19 70 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()