danwagnerco / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
1 stars 0 forks source link

add adblock in Chrome driver #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system : Win 8.1
.Net Framework version : Lastest on 29.11.14
Office Version : 2013
SeleniumWrapper version : v1.0.23.0

How to insert extensions adblock in Chrome driver.
I think need use selenium.setPreference or selenium.addArgument

Original issue reported on code.google.com by ivaniu...@gmail.com on 29 Nov 2014 at 2:44

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
sorry for my eng i`m is Ukrain user.
i try a ^
  selenium.addArgument "--app-shell-install-crx=" & "gighmmpiobklfepjocnamgkkbiglidom"
  selenium.addArgument "--load-extension=" & ThisWorkbook.Path & "\" & "adblockpluschrome-1.8.7.1271.crx"
for add AdBlock
but extension not loaded in driver after start
At last i try : selenium.addExtension ThisWorkbook.Path & "\" & 
"adblockpluschrome-1.8.7.1271.crx"
and this add extention Ty

Original comment by ivaniu...@gmail.com on 29 Nov 2014 at 6:31

GoogleCodeExporter commented 9 years ago
The working directory is not the folder of the workbook
You need to use a full path instead:

Dim driver As New SeleniumWrapper.WebDriver
driver.addExtension "C:\Documents and Settings\admin\My 
Documents\Downloads\extension_2_14_4.crx"
driver.start "chrome", "http://news.yahoo.com"
driver.open "/science"

A faster way would be to use a customized profile:

Dim driver As New SeleniumWrapper.WebDriver
driver.addArgument "--user-data-dir=C:\profile folder"
driver.start "chrome", "http://news.yahoo.com"
driver.open "/science"

Original comment by florentbr on 1 Dec 2014 at 9:38