baudehlo / node-phantom-simple

Simple bridge to phantomjs for Node
MIT License
201 stars 70 forks source link

Page CaptureContent for network content body not getting set correctly #122

Closed pharzan closed 1 year ago

pharzan commented 8 years ago

I'm trying to set the network capture content as I would using plain slimerJS with the following:

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

using the getter setter functions with the node-slimerjs bridge 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");
awlayton commented 8 years ago

I don't think node-phantom-simple supports passing regexes. I think the communication is all in JSON, so only things that JSON has will work.

puzrin commented 8 years ago

Looks like implementation restriction. Need to replace JSON data serializer to something better with date/regex support.

awlayton commented 8 years ago

Perhaps something like https://github.com/vkiryukhin/jsonfn?

puzrin commented 8 years ago

@awlayton yes. I also remember JASON, but it was not updated many years, and we dropped it from our project. I did not tracked current state of libs about this topic, but any well-supported will be ok.

PR will be accepted. Or of that's not so critical, that can be done by me sometime in far future (support from my side is not very active)

awlayton commented 8 years ago

I might be able to make a PR sometime in the future, but I am rather busy as of late.

puzrin commented 8 years ago

The same sutiation :) . We joined to do bulk changes/fixes for 1.0 -> 2.0, but those are complete and we are busy with another things. I can do quickly only critical fixes & release accepted PRs.

openrijal commented 8 years ago

any new development in this front?

puzrin commented 8 years ago

PR welcome.