原文发表于2008-09-26 23:00:43

      今天在论坛上看到这个问题,就出来说一下:Selenium-Rc单独使用,需要添加对于ThoughtWorks.Selenium.Core的引用,然后可以自定义脚本,做web自动化测试~~

贴一部分C#代码:

using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Selenium;

namespace SelenuimTestProject
{
    /// <summary>
    /// UnitTest1 的摘要说明
    /// </summary>
    [TestClass]
    public class UnitTest1
    {
        private ISelenium browser;
        public UnitTest1()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }

        [TestMethod]
        public void TestMethod1()
        {
            browser = new DefaultSelenium("localhost",
               4444, "*iexplore", "http://www.google.com");
           // browser = new DefaultSelenium("localhost",4444,@"*custom C:\Program Files\Internet Explorer\iexplore.exe","http://www.google.com");
            browser.Start();

            browser.Open("http://www.google.com/webhp?hl=en");
            browser.Type("q", "hello world");
            browser.Click("btnG");
           
            browser.WaitForPageToLoad("5000");
            browser.Stop();
           
           // Assert.AreEqual("hello world - Google Search", browser.GetTitle());
        } 
    }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2021-08-30
  • 2021-10-30
猜你喜欢
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-10-03
  • 2021-10-19
相关资源
相似解决方案