C# 如何在Mozilla Firefox 36.0.4中启动CodedUI测试中的URL
我正在测试gmail登录页面的CodedUI测试,并完成了所有操作的记录 现在我想首先启动google页面的登录页面,我已经实现了如下所示的代码C# 如何在Mozilla Firefox 36.0.4中启动CodedUI测试中的URL,c#,.net,coded-ui-tests,visual-studio-2010,C#,.net,Coded Ui Tests,Visual Studio 2010,我正在测试gmail登录页面的CodedUI测试,并完成了所有操作的记录 现在我想首先启动google页面的登录页面,我已经实现了如下所示的代码 BrowserWindow.CurrentBrowser = "IE"; this.UIMap.UIAdminloginMozillaFirWindow.LaunchUrl(new Uri("https://www.google.com")); 但错误在于: 用于在Firefox中进行测试的加载项 [TestClass] public class U
BrowserWindow.CurrentBrowser = "IE";
this.UIMap.UIAdminloginMozillaFirWindow.LaunchUrl(new Uri("https://www.google.com"));
但错误在于:
用于在Firefox中进行测试的加载项
[TestClass]
public class UnitTest1
{
FirefoxDriver firefox;
// This is the test to be carried out.
[TestMethod]
public void TestMethod1()
{
firefox = new FirefoxDriver();
firefox.Navigate().GoToUrl("http://www.google.com/");
IWebElement element = firefox.FindElement(By.Id("lst-ib"));
element.SendKeys("Google\n");
}
// This closes the driver down after the test has finished.
[TestCleanup]
public void TearDown()
{
firefox.Quit();
}
}
您可以使用Selenium组件进行编码UI跨浏览器测试,这是一组将编码UI调用转换为WebDriver调用的扩展,从而支持Firefox和Chrome 下载安装程序并运行它。如果您使用测试记录器构建测试,则“使用Internet Explorer照常录制”录制在Firefox或Chrome中不起作用。在代码中,在调用BrowserWindow.Launchurl之前,请按如下所示设置浏览器类型:
BrowserWindow.CurrentBrowser = "Firefox"; // or "Chrome" or "IE"
使用HtmlControl及其子体的几乎所有常规属性和方法。根据经验,我知道访问HtmlControl.ControlDefinition将抛出NotSupportedException,而Mouse.startDraging/stopDraging也不起作用。调试有时也很有趣。我看到了表示错误的曲线,但错误是什么?当您将鼠标悬停在LaunchUrl方法上时,VisualStudio会告诉您什么?请参阅我以前使用selenium的文章