Javascript 噩梦代理
所以我使用噩梦来生成用户使用页面获取页面代理的HTTP请求的场景 为此,我使用http代理并将其设置为: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
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