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();
        }
    }
}
How to write Selenium Test using NUnit Framework
How to write Selenium Test using NUnit Framework
Previous Article
IWebDriver Browser Commands in C#
IWebDriver Browser Commands in C#
Next Article
Virender Singh
I am Virender Singh, I have around 14 years of experience in the Technology domain.
Reviewers
Lakshay Sharma's Photo
Lakshay Sharma

Similar Articles

Feedback