I'm creating a base for automated testing of a browser extension, using typescript, selenium-webdriver (https://www.npmjs.com/package/selenium-webdriver latest version) and windows 10.
The problem is that I can not load the extension to Edge (version 44.17763.1.0)
The current test scenario is:
1) Open browser with the loaded extension
2) Go to the test page
3) Check if the elements added by the extension are present
The issue that I am facing is that Edge does not load the extension, the browser opens, proceeds to the page and fails since the elements are missing.
Here is the code for creating Edge:
function buildEdgeDriver(): WebDriver {
const service = new edge.ServiceBuilder().setPort(edgeWebdriverPort);
const extensionPaths = [edgeExtensionPath];
const cap = new Capabilities({extensionPaths});
const options = new edge.Options();
if (useBrowserExtension) {
cap.set('extensionPaths', extensionPaths);
}
return new Builder()
.withCapabilities(cap)
.forBrowser(Browser.EDGE)
.setEdgeOptions(options)
.setEdgeService(service).build();
}
According to the documentation, this should be fine: https://docs.microsoft.com/en-us/microsoft-edge/extensions/guides/packaging/creating-and-testing-extension-packages#automated-testing-with-webdriver
I also found a similar problem which was solved, but the solution did not help me: https://stackoverflow.com/questions/53073851/edge-webdriver-17134-extension-are-not-loaded
The extension is in unpacked and signed, placed in the appropriate folder:
C:\Users\PORTER\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\LocalState\extension\
I already tried providing both packed and unpacked versions of the extension and pointing the extensionPaths
to all subfolders of the unpacked extension.
Adding the extension manually to the main edge profile did not add it to the edge started by selenium. Edge always starts but always without the extension.
There are no logs indicating that there was an issue with extension loading (there are no logs at all besides the assertion error).
Any help would be much appreciated :)