How to do validations using Node JS

can anyone please give me some suggestion about how to do data validation using Node JS.

I’m thinking to verify some text info shows in an element which is located using either xpath or name.

I saw [textPresent(searchText, element, cb) -> cb(err, boolean)] in wd library. I’m not sure how to use it… can anyone give me some example? or is there any other better library that I could use?

Thanks!

[textPresent(searchText, element, cb) → cb(err, boolean)]

cb(err, boolean) describes the callback signature. You would use it like this:

driver.textPresent("foo", myElement, function(err, isPresent) {
  console.log("Text was found: " + isPresent)
});

You can also checkout the tests in wd,js’s repo: Repository search results · GitHub.