ChromeDriver driver = new ChromeDriver(); ReadOnlyCollectionlinks = driver.FindElementsByClassName("link"); foreach (IWebElement link in links) { Console.WriteLine(link.GetAttribute("href")); }
ChromeDriver driver = new ChromeDriver(); ReadOnlyCollectionIn this example, we create a new ChromeDriver instance and use the FindElementsByClassName method to find all input fields with class name "form-control". We then loop through the collection of IWebElement objects and set their values using the SendKeys method. The ChromeDriver FindElementsByClassName method is part of the OpenQA.Selenium.Chrome namespace in the Selenium.WebDriver.ChromeDriver package.inputFields = driver.FindElementsByClassName("form-control"); foreach (IWebElement inputField in inputFields) { inputField.SendKeys("test_value"); }