保存HTML源代码以便在nightwatch.js中进行调试

时间:2014-09-08 21:55:33

标签: automated-tests nightwatch.js

假设我只在一个浏览器中进行了测试失败,其中一个css / html元素是"未找到"。

截图看起来没问题。如何获取当前文档的html源代码?

1 个答案:

答案 0 :(得分:11)

使用Nightwatch的硒功能包装sourceDOC),这可以相对容易地完成。

例如:

browser
    .url("http://www.google.com")
    .source((result) => {
        // Source will be stored in result.value
        console.log(result.value);
    })