Add uBlock extension support for Firefox driver
Upgrades Selenium.WebDriver to 4.38.0 and adds logic to automatically install the uBlock extension for FirefoxDriver instances. The uBlock extension file is now included in the project and set to copy to output. Warnings are logged if the extension fails to load.
This commit is contained in:
@@ -102,6 +102,15 @@ namespace Beam.Stealth {
|
||||
driver = new RemoteWebDriver(new Uri(remoteAddress), def.Options);
|
||||
else
|
||||
driver = def.Factory(def.Options);
|
||||
|
||||
try {
|
||||
if (driver is FirefoxDriver fd)
|
||||
fd.InstallAddOnFromFile("uBlock0_1.67.0.firefox.signed.xpi");
|
||||
}
|
||||
catch {
|
||||
logger?.LogWarning("Unable to load utility extensions");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user