2、umIDE的使用》中,提到了SeleniumIDE可以把录制的脚本转为其他语言的脚本,所以我继续用上一篇的脚本为例子,下面是把脚本语言转换为C#后的代码:using System;using System.Text;using System.Text.RegularExpressions;using System.Threading;using NUnit.Framework;using Selenium;namespace SeleniumTests{ [TestFixture] public class NewTest { private
3、ISelenium selenium; private StringBuilder verificationErrors; [SetUp] public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://change-this-to-the-site-you-are-testing/"); selenium.Start();
4、 verificationErrors = new StringBuilder(); } [TearDown] public void TeardownTest() { try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close