我正在尝试向我的项目添加显式等待函数,但是我收到错误
namespace AutoProj
{
enum PropertyType
{
Id,
Name,
LinkText,
CssName,
ClassName
}
class PropertiesCollection
{
//autoimplemented properties
public static IWebDriver driver { get; set; }
}
main.cs
[TestFixture(typeof(FirefoxDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
[TestFixture(typeof(ChromeDriver))]
public class TestWithMultipleBrowsers<TWebDriver> where TWebDriver : IWebDriver, new()
{
[Test]
public void TestCase_Abc()
{
WebDriverWait wait = new WebDriverWait(PropertiesCollection.driver, 1000) ;
(PropertiesCollection.driver, 1000)
时出错。我在这里错过了什么吗?
错误说明:
错误1:最佳重载方法匹配 “OpenQA.Selenium.Support.UI.WebDriverWait.WebDriverWait(OpenQA.Selenium.IWebDriver, System.TimeSpan)'有一些无效的参数
错误2:无法将fron'int'转换为'System.TimeSpan'
答案 0 :(得分:1)
PropertiesCollection
类是私有的(默认情况下是C#),请将其公开(它看起来与您发布的内容类似。)WebDriverWait
获得时间跨度new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(10));