問題描述
我想用 Selenium WebDriver Java 激活 Adblocker for Chrome.
I would like to activate Adblocker for Chrome with Selenium WebDriver Java.
怎么做?
推薦答案
你可以使用擴(kuò)展的 crx 文件或者指向它的安裝目錄.假設(shè)你已經(jīng)安裝了它,你需要添加 ChromeOptions
到你的 new ChromeDriver
:
You can either use the crx file of the extension or point to a directory it's installed in. Assuming you have it installed, you'll need to add ChromeOptions
to your new ChromeDriver
:
請參閱此處了解更多詳情和演練.
See here for more details and walkthrough.
要查看您的擴(kuò)展路徑,請導(dǎo)航到 chrome://version
并查看配置文件路徑".在該文件夾中查找擴(kuò)展"文件夾.AdBlock Plus 的擴(kuò)展 ID 是 cfhdojbkjhnklbpkdaibdccddilifddb
.所以路徑/到/擴(kuò)展名應(yīng)該類似于(Windows):
to see your extensions path, navigate to chrome://version
and look at 'Profile Path'. In that folder look for 'Extensions' folder. The extension ID for AdBlock Plus is cfhdojbkjhnklbpkdaibdccddilifddb
. So the path/to/extension should be something like (Windows):
這篇關(guān)于如何使用 Selenium WebDriver 在 Chrome 中激活 AdBlocker?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!