Hey there, please implement the following instructions:
public class ChromeProfileWithAddOn {
public static void main(String[] args) {
// TODO Auto-generated method stub
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
// Customize ChromeDriver capabilities with ChromeOptions.
// I have added this specific add-on to Chrome: https://chrome.google.com/webstore/detail/pdf-converter/dmgnkfgleaamgbhhojkfijjmjmngokkb
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
// paste the location of .crx file obtained in step 6 here
options.addExtensions(new File("C:\\Users\\###\\Desktop\\hgmloofddffdnphfgcellkdfbfbjeloo.crx"));
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
System.getProperty("webdriver.chrome.driver","D:\\eclipseProject\\###\\src\\com\\###\\chromedriver_win32 (1)\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver(capabilities);
// initiate chrome driver
driver.navigate().to("chrome-extension://ldlmdngominhfffemgnfpoifladkpple/RestClient.html");
How to obtain the above URL :
1. open the manifest.json file where you will find "local_path":"RestClient.html"
2. make sure your extension is installed in Chrome and then
3. go to chrome://extensions/ (follow steps-3 and 4 below)
4. copy the ID value as shown in the image just below step 4
5. now you can create your URL as "chrome-extension://ID/local_path"
6. finally, open it in the Chrome browser
} }
The code remains the same but we need to adhere to some basic guidelines:
NOTE: I am using an example of Advanced REST client for ** CHROME** available at this URL:
https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
Step 1 :
`Please download or if already present, access the extension's manifest.json file`
If you want to download the add-on locally, please follow these steps:
a.> download this extension https://chrome.google.com/webstore/detail/chrome-extension-source-v/jifpbeccnghkjeaalbbjmodiffmgedin
b.> install it (on the top right corner of Chrome browser, a CRX button will appear)
c.> Now search for Advanced REST client in the Chrome Web Store or simply use this link in the browser
https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
d.> Click on the CRX image/button, two options will appear https://i.sstatic.net/sCWgp.png
Select download as zip (save it to your desired location).
e.> unzip the downloaded file
f.> Within the unzipped folder, locate the manifest.json file
Step 2 :
Copy the location of the mainfest.json file
Step 3 : Type the following address into the Chrome browser's URL section
chrome://extensions/
All installed add-ons/extensions will be displayed here
Step 4 :
please enable the Developer option
You should now see the Pack Extension option
https://i.sstatic.net/Evf2m.png
Step 5 :
Click Pack Extension and under Extension root directory:(First option) paste the location of the manifest.json file.https://i.sstatic.net/VFBK0.png
Step 6 : If you have followed all the steps above, you will see this https://i.sstatic.net/DennU.png
I hope this helps resolve your concern.