@@ -210,37 +210,45 @@ var webdriverjs = require("webdriverjs")
210
210
211
211
var proxy = new Proxy ( { host: proxyHost });
212
212
proxy .start (function (err , data ) {
213
- if (! err) {
214
- // SET AND OVERRIDE HTTP REQUEST HEADERS IF YOU WANT TO
215
- var headersToSet = {
216
- ' User-Agent' : ' Bananabot/1.0'
217
- ' custom-header1' : ' custom-header1-value' ,
218
- ' custom-header2' : ' custom-header2-value'
219
- }
220
- proxy .addHeader (data .port ,headersToSet,function (){});
221
- proxy .startHAR (data .port , ' http://search.yahoo.com' , function (err , resp ) {
222
213
if (! err) {
223
- // DO WHATEVER WEB INTERFACTION YOU WANT USING THE PROXY
224
- doSeleniumStuff (proxyHost + ' :' + data .port , function () {
225
- proxy .getHAR (data .port , function (err , resp ) {
226
- if (! err) {
227
- console .log (resp);
228
- fs .writeFileSync (' output.har' , resp, ' utf8' );
229
- } else {
230
- console .err (' Error getting HAR file: ' + err);
231
- }
232
- proxy .stop (data .port , function () {});
233
- });
214
+ // SET AND OVERRIDE HTTP REQUEST HEADERS IF YOU WANT TO
215
+ var headersToSet = {
216
+ ' User-Agent' : ' Bananabot/1.0' ,
217
+ ' custom-header1' : ' custom-header1-value' ,
218
+ ' custom-header2' : ' custom-header2-value'
219
+ }
220
+ proxy .addHeader (data .port , headersToSet, function (err ,resp ) {
221
+ if (! err) {
222
+ proxy .startHAR (data .port , ' http://localhost:8004' , function (err , resp ) {
223
+ if (! err) {
224
+ // DO WHATEVER WEB INTERFACTION YOU WANT USING THE PROXY
225
+ doSeleniumStuff (proxyHost + ' :' + data .port , function () {
226
+ proxy .getHAR (data .port , function (err , resp ) {
227
+ if (! err) {
228
+ console .log (resp);
229
+ fs .writeFileSync (' output.har' , resp, ' utf8' );
230
+ } else {
231
+ console .err (' Error getting HAR file: ' + err);
232
+ }
233
+ proxy .stop (data .port , function () {});
234
+ });
235
+ });
236
+ } else {
237
+ console .error (' Error starting HAR: ' + err);
238
+ proxy .stop (data .port , function () {
239
+ });
240
+ }
241
+ });
242
+ } else {
243
+ console .error (' Error setting the custom headers' );
244
+ proxy .stop (data .port , function () {
245
+ });
246
+ }
234
247
});
235
248
} else {
236
- console .error (' Error starting HAR: ' + err);
237
- proxy .stop (data .port ,function () {});
249
+ console .error (' Error starting proxy: ' + err);
238
250
}
239
251
});
240
- } else {
241
- console .error (' Error starting proxy: ' + err);
242
- }
243
- });
244
252
245
253
246
254
function doSeleniumStuff (proxy , cb ) {
0 commit comments