I am getting an error stating there is no definition for size() on driver.FindElements. I see the docs state this is the prefered way to conditionally locate an item and take action. Am I not including some reference?
ERROR
Error 1 'System.Collections.ObjectModel.ReadOnlyCollection<OpenQA.Selenium.IWebElement>' does not contain a definition for 'size' and no extension method 'size' accepting a first argument of type 'System.Collections.ObjectModel.ReadOnlyCollection<OpenQA.Selenium.IWebElement>' could be found (are you missing a using directive or an assembly reference?) c:\Source\GetScreenShots\Program.cs 439 78 GetScreenShots
CODE SNIPPET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium.Firefox;
using
OpenQA.Selenium.IE;
using
OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Interactions.Internal;
using OpenQA.Selenium.Support.UI;
using System.Text.RegularExpressions;
using System.Threading;
using System.IO;
using System.Collections;
//SKIP TO PROBLEM CODE
if (driver.FindElements(By.Id("ctl00_mainContent_cancelButton")).size() > 1)
//element found
{
driver.FindElement(By.Id("ctl00_mainContent_cancelButton")).Click();
}
TakeScreenShot(driver, scenario);