Bạn có thể đóng gói hoặc giải nén Tiện ích của Chrome.
- Đuôi tệp là một tệp có đuôi
.crx
. - Tiện ích đã giải nén là một thư mục chứa tiện ích, bao gồm cả tệp
manifest.json
.
Để đóng gói một tiện ích đã giải nén, hãy dùng nút Đóng gói trong chrome://extensions
hoặc
dùng Chrome: "chrome.exe --pack-extension=C:\path\to\unpacked\extension --pack-extension-key=C:\myext.pem"
. Để giải nén một tiện ích đã đóng gói, hãy trích xuất tệp đó. Bạn có thể cần đổi tên loại tệp từ .crx
thành .zip
để tiện ích zip nhận ra tệp đó.
Hãy tham khảo Tài liệu về tiện ích để biết những cách khác phù hợp với hoạt động tự động hoá hơn.
Tiện ích tích hợp với ChromeDriver
Đã đóng gói (.crx
tệp)
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
ChromeDriver driver = new ChromeDriver(options);
Đã giải nén (thư mục)
ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=/path/to/extension");
ChromeDriver driver = new ChromeDriver(options);