, Nightwatch . ( ), -. - , - Selenium WebDriver. , , , "" , CasperJS. PhantomJS, WebKit.
Nightwatch
Nightwatch, , , .source(), () DOM:
browser
.url("http://www.website.com")
.source(function (res) {
if (/<!--/.test(res.value)) {
console.log("Comment detected!");
}
})
, , DOCTYPE, .source(). XPath, /html.
, console.log , . , Nightwatch CSS...
Casper
...
Casper .getHTML(), DOM. DOCTYPE, (.assertMatch()) . :
casper.test.begin('Test website', function (test) {
casper.start('http://www.website.com', function () {
var html = this.getHTML();
test.assertMatch(html, /<!DOCTYPE html>/);
test.assertMatch(html, //);
});
casper.then(function () {
// Your code...
});
casper.run(function() {
test.done();
});
});
, HTML5 . .