Cant get explicit wait to work - WebDriverWait throws an error | Selenium C# Forum
M
mai Posted on 19/12/2018
for the following code
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public static void Main(string[] args)
{
IWebDriver driver = new ChromeDriver(@"C:\selenium\latestDriver");
 
driver.Url = @"http://seleniumtraining.com/contact-us";
driver.Manage().Window.Maximize();         
IWebElement dropdown = driver.FindElement(By.Name("country_id"));
WebDriverWait wait = new WebDriverWait(driver,TimeSpan.FromSeconds(10));
wait.Until(ExpectedConditions.ElementToBeClickable);
SelectElement s = new SelectElement(dropdown);
Console.ReadKey();
}
I am getting the following error for WebDriverWait

Severity

Code

Description

Project

File

Line

Suppression State

Error

CS0433

The type 'WebDriverWait' exists in both 'WebDriver, Version=3.141.0.0, Culture=neutral, PublicKeyToken=null' and 'WebDriver.Support, Version=2.47.0.0, Culture=neutral, PublicKeyToken=null'

ConsoleApplication1

C:\Users\nurm\Documents\Visual Studio 2015\ClassSelenium\Assign2\ConsoleApplication1\ConsoleApplication1\dropDown.cs

40

Active




M
mai Replied on 20/12/2018

still can't get explicit wait to work . I've added the following now:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Name("country_id")));//wait extra time only for this element
SelectElement s = new SelectElement(dropdown);

still get this error: The type 'WebDriverWait' exists in both 'WebDriver, Version=3.10.0.0, Culture=neutral, PublicKeyToken=null' and 'WebDriver.Support, Version=2.47.0.0, Culture=neutral, PublicKeyToken=null' 


G
gunjan Replied on 20/12/2018

Please check the version of Webdriver dll and Webdriver.Support dll.  They both should be of the same version.


M
mai Replied on 20/12/2018

it worked, thanks Gunjan for your help