assaf/zombie

How to Use Zombie.JS Without Test Framework

Jitsusama opened this issue · 2 comments

Hello,

I'm trying to use this library without a test framework in order to use it as a web navigation automation library. I'm having a hard time figuring out how to use it in such a capacity, as the documentation is geared towards using it in the Mocha test framework.

Could I get some pointers? I'm looking to use it to login via a web-form, and then navigate through various pages while pulling out pertinent details. I've tried looking through the project source code, but I'm not having much luck.

Zombie methods do not depend on any testing frameworks; therefore, I guess you can just use it.

For example,

const Browser = require('zombie')

const browser = new Browser({
  // JSDom does not support MutationObserver, https://github.com/jsdom/jsdom/issues/639
  runScripts: false 
})

browser
  .visit('https://github.com/assaf/zombie/issues/1164')
  .then(function () {
    console.log(browser.text('#issue-328636238 .author')) // Jitsusama
  })

Under the hood, zombie uses JSDom to emulate browser environment so you may also want to take a look at it.

Thanks @momocow. I had pretty much gotten to that stage, but was having an issue figuring out some of the more advanced functionality. I'll just poke around through the code until I figure it out. Thanks for the pointer to JSDom as well, that should probably help me with some of the sticky stuff I was getting confused about.