admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

Proxy is not working #469

Open ghost opened 7 years ago

ghost commented 7 years ago

As in documentation I configure proxy same way as node request:

var wd = require('wd');

browser = wd.remote('http://localhost:4444/wd/hub');
browser.init({
  browserName: 'chrome'
});
browser.configureHttp({
  timeout: 60000,
  retries: -1,
  baseUrl: 'https://google.com',
  proxy: 'http://127.0.0.1:8080'
});

When I comment the proxy line, page open just after module is exported. However, with proxy selenium open browser but page is not loaded, no errors, no action at all.

Please advise, what can cause the problem?

brownman commented 6 years ago
var wd = require('wd');

browser = wd.remote();//'http://localhost:4444/wd/hub');

var url='https://api.ipify.org?format=json'
var desired = {browserName: 'chrome'}
var desired =     
      { browserName: 'chrome',
        proxy: 
         { proxyType: 'manual',
           ftpProxy: undefined,
           httpProxy: undefined,
           sslProxy: '127.0.0.1:8081', //your proxy host:port..
           noProxy: undefined } } 

browser.init( desired , function() {
  browser.get("http://admc.io/wd/test-pages/guinea-pig.html", function() {
    browser.title(function(err, title) {
 //     title.should.include('WD');
console.log(title)
      browser.elementById('i am a link', function(err, el) {
        browser.clickElement(el, function() {
          /* jshint evil: true */
          browser.eval("window.location.href", function(err, href) {
//            href.should.include('guinea-pig2');
console.log(href)
            browser.quit();
          });
        });
      });
    });
  });
});