【问题标题】:Zombiejs browser.text method returning entire documentZombiejs browser.text 方法返回整个文档
【发布时间】:2012-02-20 01:02:13
【问题描述】:

正如标题中所说:

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('title') 返回整个页面的 html。这发生在我尝试选择的任何元素上。有什么建议吗?

【问题讨论】:

  • 你试过打开另一个网址吗?如果是这样,你会得到整个页面吗?

标签: node.js zombie.js


【解决方案1】:

如果您将代码更改为这样会发生什么:

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()

?

【讨论】:

    猜你喜欢
    • 2019-02-04
    • 1970-01-01
    • 2020-12-05
    • 1970-01-01
    • 1970-01-01
    • 2014-01-29
    • 2021-10-03
    • 2019-07-22
    • 2020-03-08
    相关资源
    最近更新 更多