0

I have this setup that is setting proxy ok in the local browser but when i try to use the grid the proxy will not be sent to the node:

var driver = new webdriver.Builder()
          .withCapabilities(webdriver.Capabilities.firefox())
          .setProxy(proxy.manual({ http : 'proxy:port',
                                   https : 'proxy:port',
                                     }))

           .build();

Result : the browser proxy is - proxy:port ;

When i add :

var driver = new webdriver.Builder()
          .withCapabilities(webdriver.Capabilities.firefox())
          .setProxy(proxy.manual({ http : 'proxy:port',
                                   https : 'proxy:port',
                                     }))
          .usingServer('http://hub:port/wd/hub') 
          .build();

The result : the browser proxy is - it showes me the ip of the hub. Question : does anyone knows why the proxy set manualy is not sent to the hub and why the browser doesn't use it ? Or any other solution for this problem ?

Milo
  • 61
  • 6

1 Answers1

0

This is the solution that worked :

var webdriver = require('selenium-webdriver'),
firefox = require('selenium-webdriver/firefox'),
proxy = require('selenium-webdriver/proxy')
driver = null,
profile = new firefox.Profile();
profile.setPreference("network.proxy.type", 1); // Manual proxy config
profile.setPreference("network.proxy.http", "proxy");
profile.setPreference("network.proxy.http_port", port);
profile.setPreference("network.proxy.ssl", "proxy");
profile.setPreference("network.proxy.ssl_port", port);

var opts = new firefox.Options();
opts.setProfile(profile);
var driver = new webdriver.Builder()
  .withCapabilities(webdriver.Capabilities.chrome())
  .setFirefoxOptions(opts);
  .build();
Milo
  • 61
  • 6