0

I want to have access to filesystem on a page that is rendering by PhantomJS headless browser.

I catch an error when JS code is trying to interact with filesystem

var fs = require('fs');
...
ReferenceError: Can't find variable: require

Is there some hack/plugin to PhantomJS that allows to do that?

P.S. I'm using headless tests runner based on PhantomJS (teaspoon) and I want to store some data from tests on filesystem.

petRUShka
  • 9,812
  • 12
  • 61
  • 95
  • I have no idea how teaspoon works, but I doubt that it has access to the PhantomJS context. The most probable answer is **no**. – Artjom B. Jun 11 '15 at 12:52
  • My hope is based on fact that PhantomJS isn't browser for users, but for testing. So may be there are some opportunities to extend it functionality in a way traditional browsers aren't extendable to. – petRUShka Jun 11 '15 at 13:01
  • 1
    Sure, PhantomJS is extensible and it can do this sort of thing. It's a limitation of the tools that build on top of it. – Artjom B. Jun 11 '15 at 13:12

0 Answers0