问题
I created a new firefox profile via selenium geckodriver, and I am trying to add a new extension to this profile via the in built method AddExtension("xpi path"). I have no run-time errors, however when the browser opens, it's like no extensions were installed. In fact when I check the add-on tab, there are no add-ons/extensions.
private void btnCreate_Click(object sender, EventArgs e) {
var profile = new FirefoxProfile();
profile.AddExtension( @ "C:\Users\danza\AppData\Roaming\Mozilla\Firefox\Profiles\vdxp2a78.kelley\extensions\hotspot-shield@anchorfree.com.xpi");
var firefoxOptions = new FirefoxOptions { Profile = profile };
var firefoxDriver = new FirefoxDriver(firefoxOptions);
firefoxDriver.Navigate().GoToUrl("http://www.google.com");
}
The below image is the add-on tab with the above code, proving that no addon was actually added.
来源:https://stackoverflow.com/questions/57778036/cannot-load-extension-using-firefox-driver-selenium-when-using-addextension