Extension in the Chrome browser

I need help in adding an extension to the chrome browser, for example “Sign Token”. In the test cases the following portion of code is added:

System.setProperty(“webdriver.chrome.driver”, “C:\\Users\\usuario\\katalon\\Test\\Driver\\chromedriver.exe”);

ChromeOptions options = new ChromeOptions()

options.addExtensions(new File(“C:\\Users\\usuario\\Desktop\\Firma-con-token.crx”))

DesiredCapabilities capabilities = new DesiredCapabilities()

capabilities.setCapability(ChromeOptions.CAPABILITY, options)

ChromeDriver Chrome = new ChromeDriver(capabilities)

This code does not allow me to use the methods of Katalon Studio. You need to know how you can add extensions to browsers. You can not add extensions in the browsers’ parameters.

I await your help

Could you send any error message when you using this code?

The code does not produce an error when executing it. The query was created to add an extension in the browser when the test case is run.How to add an extension in the navigated Katalon Studio?

You should use below code instead:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\usuario\\katalon\\Test\\Driver\\chromedriver.exe");
ChromeOptions options = new ChromeOptions()
options.addExtensions(new File("C:\\Users\\usuario\\Desktop\\Firma-con-token.crx"))
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.setCapability(ChromeOptions.CAPABILITY, options)
WebDriver driver = new ChromeDriver(capabilities)
DriverFactory.changeWebDriver(driver)

Please refer to this page if you want to use unpacked extension: https://sites.google.com/a/chromium.org/chromedriver/extensions

Above code will change default WebDriver of Katalon Studio to your desired options, you can use other methods of Katalon Studio afterward.

1 Like

Thank you very much Vinh Nguyen. It works perfect

Vinh… Can’t I add equivalent code using Desired Capabilities option under Project Settings ?
Because I am not able to make use of options like “Delay between actions” if I follow this. Any thoughts…