- Selenium WebDriver 3 Practical Guide
- Unmesh Gundecha Satya Avasarala
- 118字
- 2021-08-13 16:08:15
Adding ChromeExtensions
Similar to Firefox, we can add extensions to the Chrome browser by specifying the location of the extension. We can add Packed (.crx file) or Unpacked (folder) extensions using the ChromeOptions class.
To add a Packed extension, we need to call the addExtension() method:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addExtensions(new File("/path/to/extension.crx"));
ChromeDriver driver = new ChromeDriver(chromeOptions);
To add an Unpacked extension, we need to use the addArguments() method, which will load the extension reading the specified folder while launching the Chrome binary. This is done as follows:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("load-extension=/path/to/extension");
ChromeDriver driver = new ChromeDriver(chromeOptions);
Similarly, you can use Chrome options to add more extensions, arguments, and Binaries to your Chrome browser.
推薦閱讀
- 物聯(lián)網(wǎng)識(shí)別技術(shù)
- Truffle Quick Start Guide
- 物聯(lián)網(wǎng)信息安全
- 網(wǎng)絡(luò)互聯(lián)技術(shù)(實(shí)踐篇)
- 大話社交網(wǎng)絡(luò)
- 數(shù)字通信同步技術(shù)的MATLAB與FPGA實(shí)現(xiàn):Altera/Verilog版(第2版)
- Socket.IO Real-time Web Application Development
- 城市治理一網(wǎng)統(tǒng)管
- 城域網(wǎng)與廣域網(wǎng)(第2版)
- 圖解手機(jī)元器件維修技巧
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)及應(yīng)用
- Learning Windows 8 Game Development
- 5G+區(qū)塊鏈
- LwIP應(yīng)用開(kāi)發(fā)實(shí)戰(zhàn)指南:基于STM32
- Getting Started with tmux