1

We have addon to chrome to use some featuren on our test server. How can i integrate our addon to crome driver if its possible?

I'm using chrome driver like this

public void Before(){
        System.setProperty("webdriver.chrome.driver",
                "J:\\Java_Testing\\chromedriver\\chromedriver.exe");
        driver = new ChromeDriver();}
Dmitry Feniks
  • 65
  • 1
  • 8

1 Answers1

1

https://sites.google.com/a/chromium.org/chromedriver/extensions. Chrome extensions can be either packed or unpacked. Packed extensions are a single file with a .crx extension. Unpacked extensions are a directory containing the extension, including a manifest.json file.

To pack an unpacked extension, use the Pack button in chrome://extensions or use Chrome: "chrome.exe --pack-extension=C:\path\to\unpacked\extension --pack-extension-key=C:\myext.pem". See the extensions docs for other ways to do this that are more automation friendly. To unpack a packed extension, just unzip the file (you may need to rename the file from .crx to .zip for your zip utility to recognize it). Installing extensions via ChromeDriver

Packed (.crx file)

ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);

Unpacked (directory)

ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=/path/to/extension");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
Shubham Jain
  • 16,610
  • 15
  • 78
  • 125