我已经扩展了 Selenium 命名空间。但它仍然无法识别 GetXpathCount() 函数。有谁知道解决方案?谢谢!
int count = Selenium.GetXpathCount("ctl00_ContentPlaceHolder1_TVNCategoryGridView");
我收到以下错误消息:
命名空间“Selenium”中不存在类型或命名空间名称“GetXPathCount”(您是否缺少程序集引用?)
这是整个代码结构:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Selenium;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
using System.Threading;
using NUnit.Framework;
.......(test class extending base test)
public void TestSetup()
{
Driver = CreateDriverInstance(BaseUrl);
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
Driver.SwitchTo().Window(Driver.CurrentWindowHandle);
}
[TestCleanup()]
public void TestCleanup()
{
Driver.Quit();
}
[Priority(1), TestMethod]
public void NewShowTest()
{
Open("~/NewShow.aspx");
Random rnd = new Random(DateTime.Now.Second);
string shownum = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + rnd.Next(0, 10000).ToString();
testShowName = "Test Show " + shownum;
int count = Selenium.GetXpathCount("ctl00_ContentPlaceHolder1_TVNCategoryGridView");
..........
}