Install proxy server in nightwatch.js

I write integration tests using nightwatch.jsin-app Node.js. For a specific test, I want nightwatch to connect via proxy. What would be the right way to do this? I cannot find any of its official documentation or from the Google Group .

The documentation Seleniumsuggests installing it on a webdriver instance, as described here . I'm not sure how to do this with night vision.

+4
source share
3 answers

In the nightwatch.json configuration file, you must set the proxy parameter in the desired features:

"chrome" : {
  "desiredCapabilities": {
    "browserName": "chrome",
    "javascriptEnabled": true,
    "acceptSslCerts": true,
    "chromeOptions" : {
      "args" : [
        "disable-extensions",
        "start-maximized"
      ]
    },
    "proxy": {
      "proxyType": "manual",
      "httpProxy": "your_proxy:8080"
    }
  }
},

: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Proxy_JSON_Object

+5

- socks5. JsonWireProtocol socksProxy, :

message: 'unknown error: cannot parse capability: proxy from unknown error:
proxyType is \'manual\' but no manual proxy capabilities were found

- socks5, proxy.pac - proxyType: 'pac' proxyAutoconfigUrl, - . .

, , , :

  • CLI
desiredCapabilities: {
  browserName: 'chrome',
  /* … */
  chromeOptions: {
    args: [
      '--proxy-server=socks5://proxy_url:proxy_port'
    ]
  }
}

* edit: : 2. sslProxy
- socks , ssl, , . , , :

desiredCapabilities: {
  browserName: 'chrome',
  /* … */
  proxy: {
    proxyType: 'manual',
    sslProxy: 'socks5://proxy_url:proxy_port'
  }
}

, , - socks5.:)
, chromedriver JsonWireProtocol .

+3

Nightwatch - nightwatch.conf.js, - http-proxy, , . , -. "", , - github. .

firefox: {
      desiredCapabilities: {
        browserName: 'firefox',
        version: 'latest',
      },
      proxy: {
        host:'127.0.0.1',
        port:8001,
        protocol: 'http',
      },
    },
0

Source: https://habr.com/ru/post/1589308/


All Articles