Hello,

I'm trying to use HTTP module for communicating with chromedriver. Not a 
quite common use case, of course... Surprisingly, even when the all the 
parts are reliable, they do not work together.

Here are the steps to reproduce:

1. Download chromedriver test and unpack it
    
http://code.google.com/p/chromedriver/downloads/detail?name=chromedriver_test.zip
2. Run the run_test.bat file from the test
    it only runs chromedriver.exe and use wget to sent the request to the 
driver as follows:
    wget\wget.exe http://127.0.0.1:33791/session --post-file=new_session.txt
    the new_session.txt file contains the following string:
    { "desiredCapabilities": {}}
    It works well.
3. I've created a simple node.js file with the following content:
var data = '{ "desiredCapabilities": {}}',
    req = require('http').request(
        { host : '127.0.0.1', port : 33791, method : 'POST',
            path : '/session', headers : {
                'Content-length' : data.length,
                'Accept' : '*/*',
                'Content-type' : 'application/x-www-form-urlencoded'
            }
        },
        function (res) {
            console.log('DEBUG STATUS: ' + res.statusCode);
            console.log('DEBUG HEADERS: ' + JSON.stringify(res.headers));
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                console.log(chunk);
            });
        }
    );
req.on('error', function(e) {
    console.log('problem with request: ' + e.message);
});
req.end(data);

It is supposed to do exactly the same that the wget in the chromedriver 
test does. But it does not - the driver returns
DEBUG STATUS: 400
DEBUG HEADERS: {"content-length":"77","content-type":"application/json; 
charset=utf-8"}
{"status":400,"value":{"message":"Missing or invalid 
'desiredCapabilities'"}}
instead of opening new chrome window.

Maybe you have the ideas on what's going on?

Node version: 0.6.17

Thanks,
Alex



-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to