I want to test a ported Firefox Addon with Selenium, as I'm already doing with Google Chrome. This extension works with a custom website and the development version of this website is serve under 127.0.0.1:9000. I need to work with content scripts, but they are not injecting in my page whereas they inject in the production version of my service.
I searched in the documentation of Web Extensions, but the only thing I found is that I should not mention the port number of my webpage. I tried to remove the port from my manifest, but it's still not injecting. When I use a Nginx config to map my service to a local domain with no port, it works. Unfortunately it's not possible for me to use an Nginx config on my CI, I need to work with 127.0.0.1.
Here is a subset of my manifest.json
file:
{
"manifest_version": 2,
"permissions": [ "tabs" ],
"content_scripts": [
{
"matches": [
"http://127.0.0.1:9000/*",
"https://example.org/*",
],
"js": ["content-script.js"]
}
]
}
My content script will interact with https://example.org/
but not with http://127.0.0.1:9000/
... (this works perfectly with Chrome)
Is there any way to make a content script interact with 127.0.0.1 and a custom port?
This worked for me just now, just leave off the port number.
"matches": ["http://127.0.0.1/*"]
It's mentioned in on of the notes in the doc https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns (search for 1234
to go directly to the note)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With