Table of Contents
Before using Selenium webdriver to write tests against a Safari browser we have to prepare our Safari browser. To do that I will point you to a similar tutorial but in Java. Please go through the tutorial here. Follow till step 4 and come back here once you have configured Safari browser extension Now its all about instantiating a SafariDriver class and then using it. Below is the code to do that
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.Safari;
using OpenQA.Selenium;
namespace RunningSafari
{
class Program
{
static void Main(string[] args)
{
IWebDriver driver = new SafariDriver();
driver.Navigate().GoToUrl("https://toolsqa.com");
driver.Navigate().Refresh();
}
}
}