public TravianVillage resources(TravianVillage village) { var r1 = new List <string>(); r1.Add(chrome.FindElement(By.XPath("//*[@id=\"l1\"]")).Text); r1.Add(chrome.FindElement(By.XPath("//*[@id=\"l2\"]")).Text); r1.Add(chrome.FindElement(By.XPath("//*[@id=\"l3\"]")).Text); r1.Add(chrome.FindElement(By.XPath("//*[@id=\"l4\"]")).Text); village.Resources = new List <double>(); foreach (string res in r1) { village.Resources.Add(Convert.ToInt64(new String(res.Where(Char.IsDigit).ToArray()))); } r1 = new List <string>(); r1.Add(chrome.FindElement(By.Id("stockBarWarehouse")).Text); r1.Add(chrome.FindElement(By.Id("stockBarGranary")).Text); village.Storage = new List <long>(); foreach (string stor in r1) { village.Storage.Add(Convert.ToInt64(new String(stor.Where(Char.IsDigit).ToArray()))); } try { chrome.FindElement(By.Id("production")).FindElements(By.ClassName("num")); } catch { chrome.Navigate().GoToUrl(urld1); chrome.FindElement(By.Id("production")).FindElements(By.ClassName("num")); } village.Production = new List <double>(); foreach (IWebElement element in chrome.FindElement(By.Id("production")).FindElements(By.ClassName("num"))) { village.Production.Add(Convert.ToInt64(new String((element.Text).Where(Char.IsDigit).ToArray()))); } return(village); }