I'm currently in the process of setting up automated tests for a web application I've been developing, and I've encountered an issue that has left me puzzled.
Since it's a browser-based app, I decided to start off with a basic static server setup:
import http from 'http';
let serve = serveStatic(path);
server = http.createServer(function(req, res) {
var done = finalhandler(req, res);
serve(req, res, done);
});
However, during my testing phase, I kept encountering an error message stating HTTP method not allowed
let options = new firefox.Options();
options.headless();
let capabilities = webdriver.Capabilities.firefox().set('acceptInsecureCerts', true);
let driver = new webdriver.Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.withCapabilities(capabilities)
.build();
await driver.get('http://127.0.0.1:3030/index.html');
let tab = await driver.findElement(state.By.css('ps-tabpanel'));
tab = await tab.getShadowRoot(); // HTTP method not allowed
Upon a gut feeling, I decided to switch to an HTTPS
connection
import http from 'https';
Surprisingly enough, this change led to a completely different error popping up
await driver.get('https://127.0.0.1:3030/index.html');
// Reached error page: about:neterror?e=nssFailure2&u=https%3A//127.0.0.1%3A3030/index.html&c=UTF-8&d=%20
So, my primary question at this point would be: what am I doing incorrectly in attempting to access the shadowRoot
using Javascript Selenium?
Just to provide some context, I am working with:
- mocha + selenium + firefox
- gitpod environment
- Prior to this issue, I had managed to successfully run a test verifying connectivity to
example.com
.