在下面的selenium webdriver代码中,我收到了wait.until的错误
在调试模式下运行程序时
参考如下
IEEXECRemote
nunit.framework
Selenium.Webdriverbackedselenium
系统
System.data
的System.Xml
Thoughtworks.selenium.core
的webdriver
webdriver.support
我得到的错误是这样的
Error 4 The type 'System.Func`2<T0,T1>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. F:\AutomationProjects\Selenium\Webautomate\Webautomate\DragandDropWebElement.cs 37 1 Webautomate
如何解决此错误?我是否可以参考添加到解决方案
我尝试添加System.core,但它说它已经存在并且不接受它
我在Google上做了一些研究,但无法解决问题,因此我在这里问。
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Interactions.Internal;
namespace Automation
{
class DragandDropWebElement
{
static void Main(string[] args)
{
IWebDriver driver=null;
try
{
driver = new FirefoxDriver();
driver.Url = "http://www.google.co.in";
driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10));
driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(ExpectedConditions.TitleContains("Google"));
string title = driver.Title;
System.Console.WriteLine("Title is :" +title);
Actions builder = new Actions(driver);
IWebElement e1 = driver.FindElement(By.CssSelector("#gbqfq"));
IWebElement e2 = driver.FindElement(By.PartialLinkText("Hindi"));
bool displayed = e1.Displayed;
bool enabled = e1.Enabled;
string text = e1.Text;
System.Console.WriteLine(" The inner Text of e1 is : " +enabled );
}
catch(Exception e){
Console.WriteLine("Exception ******"+e.ToString());
}
finally{
Thread.Sleep(2000);
driver.Quit();
Console.ReadLine();
}
}
}
}