Currently, I am working on setting up a test using selenium-webdriver
in my project running on Ubuntu 20.04
I successfully installed it using yarn add selenium-webdriver
. However, I am facing an issue with safaridriver which seems to be missing.
Whenever I execute the command npx mocha test/**/*.spec.cjs
, I encounter the following error message:
The version of safari cannot be detected. Trying with latest driver version
Error: Unable to obtain browser driver. For more information on how to install drivers see https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. Error: Error executing command for /home/new/projects/projectName/node_modules/selenium-webdriver/bin/linux/selenium-manager with --browser,safari,--output,json: safaridriver not available for download
const { By, Builder, Browser } = require('selenium-webdriver');
const { suite } = require('selenium-webdriver/testing');
const assert = require("assert");
suite(function (env) {
describe('First script', function () {
let driver;
before(async function () {
driver = await new Builder().forBrowser('chrome').build();
});
after(async () => await driver.quit());
it('First Selenium script', async function () {
await driver.get('https://www.selenium.dev/selenium/web/web-form.html');
let title = await driver.getTitle();
assert.strictEqual("Web form", title);
await driver.manage().setTimeouts({ implicit: 500 });
let textBox = await driver.findElement(By.name('my-text'));
let submitButton = await driver.findElement(By.css('button'));
await textBox.sendKeys('Selenium');
await submitButton.click();
let message = await driver.findElement(By.id('message'));
let value = await message.getText();
assert.strictEqual("Received!", value);
});
});
}, { browsers: [Browser.CHROME, Browser.FIREFOX] });
Any suggestions on how to resolve this safaridriver issue?
Thank you