I’m using zombie.js, a headless browser mostly for testing purposes. It creates a browser object that once the function visit() is called allows you to play with the DOM of a given page. However, I wasn’t able to get it to that extent. It looks like there is an issue with the parser used in zombie.
Here is the error:
User/murf/Documents/workspace/node_code/node_modules/zombie/node_modules/html5/lib/html5/tokenizer.js:62
Has anyone found a similar issue? If so, is there a way to go around it? Or maybe is there is another node module that does similar work? Any idea is greatly appreciated.
Thanks
ZombieJS and other web testing tools is built on JSDOM which is really easy to use just like Zombie. However the thing is you don’t have stuff like “type” but you could easily simulate it in JSDOM, example:
That is a code sample from JSDOM, so if you want for example to simulate type you’ll have to trigger for instance
keydownmanuallyThat will somehow simulate
type('x'), for ex. for google search that will trigger getting the suggestion box.However in order to properly simulate it, you have to create a keydown event with keyCode and everything.
I’m working on a new headless browser for Node called htmlnode, but its still work in progress, expected to be usable next week, and its built on top of HtmlUnit.
Other options: