user3931772
user3931772

Reputation: 97

Safari is not working with selenium webdriver. Any solution?

 [TestClass]
public class Safari
 {
    private IWebDriver driver = new SafariDriver();         

    [TestMethod]
    public void SafariTest()
    {
        driver.Navigate().GoToUrl("http://sso.local.elasticgrid.com");
        driver.Manage().Window.Maximize();

        IWebElement email = driver.FindElement(By.Id("Email"));
        email.SendKeys("example.com");

        IWebElement password = this.driver.FindElement(By.Id("Password"));
        password.SendKeys("abcd");
        System.Threading.Thread.Sleep(500);

        IWebElement login = this.driver.FindElement(By.XPath("//button[contains(.,'Log In')]"));
        login.Submit();
        System.Threading.Thread.Sleep(500);
    }        
}

When I run my test, it opens the safari browser but doesn't navigate to the URL. It navigates to the localhost:55303 and stop working. Couldn't find the solution. Any suggestion or answer? Thanks.

Upvotes: 0

Views: 239

Answers (1)

sibi
sibi

Reputation: 174

you have to add the path to the safari exe in order to use safari browser,

safaridriver obj = new safaridriver(new file("path"));

Upvotes: 1

Related Questions