Example #1
0
        public void setResourcesData()
        {
            this.driver.Navigate().GoToUrl(this.url + "dorf1.php?newdid=" + this.villageID);
            ReadOnlyCollection<IWebElement> areas = this.driver.FindElement(By.Id("rx")).FindElements(By.TagName("area"));

            int count = 0;
            foreach (IWebElement area in areas)
            {

                Building building = new Building();

                string[] splitAlt = this.driver.FindElement(By.Id("rx")).FindElements(By.TagName("area"))[count].GetAttribute("Alt").Split(' ');
                building.name = splitAlt[0];

                building.level = splitAlt[(splitAlt.Length) - 1];
                if (!(area.GetAttribute("href").Split('=').Length == 1))
                {
                    building.id = area.GetAttribute("href").Split('=')[1];
                }

                this.resources.Add(building);
                count++;
            }
        }
Example #2
0
        public void setBuildingsData()
        {
            this.driver.Navigate().GoToUrl(this.url + "dorf2.php?newdid=" + this.villageID);
            ReadOnlyCollection<IWebElement> areas = this.driver.FindElement(By.Id("clickareas")).FindElements(By.TagName("area"));

            //TODO: new system
            int count = 0;
            foreach (IWebElement area in areas)
            {
                if (this.driver.FindElement(By.Id("clickareas")).FindElements(By.TagName("area"))[count].GetAttribute("Alt") != "Gradbeno mesto")//če je prazno gre naprej
                {
                    Building building = new Building();
                    string[] splitAlt = this.driver.FindElement(By.Id("clickareas")).FindElements(By.TagName("area"))[count].GetAttribute("Alt").Split('<');

                    building.name = splitAlt[0].Substring(0, (splitAlt[0].Length) - 1);
                    splitAlt = splitAlt[1].Split(' ');
                    building.level = splitAlt[(splitAlt.Length) - 1];
                    building.id = this.driver.FindElement(By.Id("clickareas")).FindElements(By.TagName("area"))[count].GetAttribute("href").Split('=')[1];

                    this.Buildings.Add(building);
                    count++;
                }
                else
                {

                }
            }
        }