[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);
}
}
当我运行测试时,它会打开Safari浏览器,但不会导航到该URL。它导航到localhost:55303并停止工作。无法找到解决方案。有任何建议或答案吗?感谢。
答案 0 :(得分:1)
你必须添加safari exe的路径才能使用safari浏览器,
safaridriver obj = new safaridriver(new file("path"));