0

I'm trying to set the network capture content using node-slimerjs bridge for node js. What I would do using plain slimerJS is the following:

page.captureContent = [/html/, /text/];

but I have to use the getter setter functions in the node-slimerjs library so using the these functions I'm using the following code:

page.set('captureContent',[/text/,/html/]);

but the setter function isn't setting the value correctly and I'm left with the empty body for the network responses with text/* and html/* types. After setting the captureContent if I try to read the value with console.log I can see that only an empty object has been set to the capture content:

page.get('captureContent', function(err,val){
        console.log('captureContent::: ',val)
        });

from node console:

captureContent::: [ {}, {} ]

I also tried creating new regex objects and setting them using the setter function but got the same result.

var re = new RegExp("html");
var re2 = new RegExp("text");

In the SlimerJS documentation it is stated that by default this is limited to avoid memory problems. So it may be possible to unlimit this so... How can I set the pageContent in slimerJS either globally or from node-slimerJS library so I can see the network body for responses with certain content types?

Farzan
  • 607
  • 1
  • 8
  • 27
  • 1
    The regexes probably need to be serialized before sending it to the slimerjs process from the node-bridge, but the script on the other side probably doesn't know how it can be deserialized. Can you use plain strings? – Artjom B. Mar 14 '16 at 21:31
  • the reason you've described sounds logical but unfortunately using plain strings didn't do the job. I mean I tried 'text/plain' since I want the body for plain text responses but didn't work. I also tried the regex in a string. – Farzan Mar 14 '16 at 23:22

0 Answers0