This is my code in C# I press the delete button and open a pop up where I select the amount of deletions that I want to delete and press again on delete it will delete. PropertiesCollections.driver.FindElement(By.LinkText("Delete")).Click(); new SelectElement(PropertiesCollections.driver.FindElement(By.XPath("(//select[@id='remove_shares'])[2]"))).SelectByText("1"); PropertiesCollections.driver.FindElement(By.XPath("(//button[@type='button'])[2]")).Click(); __________________________________________________________________ What I'm trying to do is record a loop every time I press delete and open a pop-up window, find the highest value inside the dropdown and select it and delete. But just every time the values inside the dropdown are changed PropertiesCollections.driver.FindElement(By.LinkText("Delete")).Click(); var mySelectElm = PropertiesCollections.driver.FindElement(By.XPath("(//select[@id='remove_shares'])[2]")); var mySelect = new SelectElement(mySelectElm); var values = mySelect.SelectedOption; foreach (var option in values) { Console.WriteLine(option.Text); //Prints "Option", followed by "Not Option" PropertiesCollections.driver.FindElement(By.XPath("(//button[@type='button'])[2]")).Click(); } ________________________ that the error I get but I need help with writing the code better: > Error 1 > > foreach statement cannot operate on variables of type > 'OpenQA.Selenium.IWebElement' because > 'OpenQA.Selenium.IWebElement' does not contain a public definition > for 'GetEnumerator' > > C:\Users\Numg\Desktop\selenium\ConsoleApplication5\ConsoleApplication5\Program.cs 54 17 ConsoleApplication5