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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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://original.toolsqa.com"); driver.Navigate().Refresh(); } } } |