I am not sure why its not able to identify the control holding the value. I tried with Class as well which did not work. Could any one please let me know what should a do.
this is my code
string locator = string.Format("//*[@class='getlist']/div");
Random elenumber = new Random();
int num = elenumber.Next(1, 10);
IWebElement fav = driver.FindElement(By.XPath(locator + "[" + num + "]" + "/div[@class='col-xs-12 col-md-4 col-sm-4 left-hm-contactus-hm']/div/div[@class='col-md-6 fav_hm']/center/form/input[@name='add']"));
Console.WriteLine(fav);
fav.Click();
Thread.Sleep(1000);
this is the error i'm getting
OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class='getlist']/div[1]/div[@class='col-xs-12 col-md-4 col-sm-4 left-hm-contactus-hm']/div/div[@class='col-md-6 fav_hm']/center/form/input[@name='add']"}