Inject Proxy Settings in Selenium/Chrome

Posted by in Software, Tutorial

I have the following situation: I’m behind a corporate proxy and I need to run a test accessing an external website. To do this, I’ve picked up chrome/chromium as driver of choice. My current solution implies an authentication via plugin.

The plugin

The chrome plugin is essentially 2 files:

  • a manifest file
  • a JS containing a listener

Manifest

The manifest file is:

The script

Following script performs the proxy authentication:

,where the PROXY_* variables are the components of the proxy URL.

Plugin

The plugin is created by zipping the two files:

Selenium

Once the zip file is created, we need to add it to the chrome:

The full script is in the Gist below:

HTH,


A little experiment: If you find this post and ad below useful, please check the ad out :-)