I have an automated WebUI tesing case which is supposed to test a website on accessibility. It's working fine and giving me the required output locally on my Mac but unfortunately failing on my VM (Ubuntu 22.04.1 LTS).
This is the source code:
const AxeBuilder = require('@axe-core/webdriverjs');
const { Builder, By, Key, promise, until } = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
promise.USE_PROMISE_MANAGER = false;
const options = new firefox.Options();
options.headless();
const driver = new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();
async function main() {
await driver.get('https://digital.hamburg.de/').then(() => {
new AxeBuilder(driver).analyze(async (err, results) => {
try {
console.log(results.violations);
} catch (e) {
console.log("Something went wrong", e.message);
} finally {
await driver.close()
}
});
});
}
main();
And the following my output which I'm getting from the VM:
(node:38796) UnhandledPromiseRejectionWarning: Error: Server terminated early with status 2
at /home/jenkins/workspace/test/node_modules/selenium-webdriver/remote/index.js:248:24
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:38796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:38796) UnhandledPromiseRejectionWarning: Error: Server terminated early with status 2
at /home/jenkins/workspace/test/node_modules/selenium-webdriver/remote/index.js:248:24
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:38796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
I'm quite a newbie at this and glad for any help.