I am trying to load webpage in Safari via Webdriver in Selenium. As per Selenium documentation Safari is inbuilt, but not able to find any docs on how to do that in NodeJS.
Selenium officially supported browser list:
There is sample code of usage on chrome driver as below:
const {Builder} = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const service = new chrome.ServiceBuilder('/path/to/chromedriver');
const driver = new Builder().forBrowser('chrome').setChromeService(service).build();
But not able to find anythin specific to safari. So it would be great if someone can help me understanding how to import safari webdriver from selenium npm package and use it for simulating webpage loading?
I did found some doc from Apple, "Testing with WebDriver in Safari", related to the same but in Python(?)
from my Mac M1, enable first
/usr/bin/safaridriver --enable
then
const {Builder, By, Key, until} = require('selenium-webdriver');
(async function example() {
let driver = await new Builder().forBrowser('safari').build();
try {
await driver.get('https://www.google.com');
} finally {
await driver.quit();
}
})();