Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 噩梦代理_Javascript_Proxy_Nightmare - Fatal编程技术网

Javascript 噩梦代理

Javascript 噩梦代理,javascript,proxy,nightmare,Javascript,Proxy,Nightmare,所以我使用噩梦来生成用户使用页面获取页面代理的HTTP请求的场景 为此,我使用http代理并将其设置为: var http = require('http'), httpProxy = require('http-proxy'); httpProxy.createProxyServer({target:'http://localhost:9000', auth: 'test:test'}).listen(8000); http.createServer(function (req, r

所以我使用噩梦来生成用户使用页面获取页面代理的HTTP请求的场景 为此,我使用http代理并将其设置为:

var http = require('http'),
    httpProxy = require('http-proxy');

httpProxy.createProxyServer({target:'http://localhost:9000', auth: 'test:test'}).listen(8000);
http.createServer(function (req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
  res.end();
}).listen(9000);
var nightmare = Nightmare({show: true,
        switches : {
            'proxy-server': 'localhost:9000;',
            'ignore-certificate-errors': true,
        }})
nightmare.authentication('test', 'test')
        .goto('http://localhost:4200/login')
        .type('#name', 'test'+user)
        .type('#pwd', 'test'+user)
        .click('#log')
        .wait('body')
然后我用梦魇这个词:

var http = require('http'),
    httpProxy = require('http-proxy');

httpProxy.createProxyServer({target:'http://localhost:9000', auth: 'test:test'}).listen(8000);
http.createServer(function (req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
  res.end();
}).listen(9000);
var nightmare = Nightmare({show: true,
        switches : {
            'proxy-server': 'localhost:9000;',
            'ignore-certificate-errors': true,
        }})
nightmare.authentication('test', 'test')
        .goto('http://localhost:4200/login')
        .type('#name', 'test'+user)
        .type('#pwd', 'test'+user)
        .click('#log')
        .wait('body')

但当我启动它时,噩梦会出现在代理上(因此localhost:9000)并忽略goto(localhost:4200),有人能帮我吗?

尝试用127.0.0.1替换一个或两个localhost,尝试用127.0.0.1替换一个或两个localhost