private void FindAltName(IList <string> animeUrls, IList <Anime> animes)
 {
     for (int i = 0; i < animeUrls.Count; i++)
     {
         webDriver.Url = animeUrls[i];
         foreach (IWebElement element in webDriver.FindElements(By.ClassName("spaceit_pad")))
         {
             try
             {
                 Anime currentAnime = animes[i];
                 if (element.FindElement(By.TagName("span")).Text.Equals("English:"))
                 {
                     currentAnime.AltName         = element.Text.Replace("English: ", "");
                     currentAnime.WatchedEpisodes = folderProvider.GetWatchedEpisodeCount(currentAnime);
                     currentAnime.CurrentEpisode  = folderProvider.GetCurrentEpisode(currentAnime);
                 }
                 if (IsSignedIn && UpdateEpisodes)
                 {
                     IWebElement watchedEpisodesTextBox = webDriver.FindElements(By.Id("myinfo_watchedeps"))[1];
                     watchedEpisodesTextBox.Clear();
                     watchedEpisodesTextBox.SendKeys(currentAnime.WatchedEpisodes.ToString());
                     watchedEpisodesTextBox.SendKeys(Keys.Enter);
                 }
             }
             catch (NoSuchElementException)
             {
             }
         }
     }
 }
        public ICollection <Anime> GetAnimes(IWebDriver webDriver, string destination)
        {
            this.webDriver = webDriver;
            IList <string> animeUrls = new List <string>();

            //Handle updated Privacy Policy
            try
            {
                webDriver.FindElement(By.ClassName("modal-content")).FindElement(By.TagName("Button")).Submit();
            }
            catch (NoSuchElementException) { }

            folderProvider = new FolderChecker(destination);
            IList <Anime> animes = new List <Anime>();

            foreach (IWebElement animeRow in webDriver.FindElements(By.ClassName("list-item")))
            {
                Anime       currentAnime = new Anime();
                IWebElement nameElement  = animeRow.FindElement(By.ClassName("title")).FindElement(By.TagName("a"));
                animeUrls.Add(nameElement.GetAttribute("href"));
                currentAnime.Name = nameElement.Text;

                IWebElement progressDiv = animeRow.FindElement(By.ClassName("progress"));
                currentAnime.WatchedEpisodes = folderProvider.GetWatchedEpisodeCount(currentAnime);
                currentAnime.CurrentEpisode  = folderProvider.GetCurrentEpisode(currentAnime);

                try
                {
                    currentAnime.TotalEpisodes = Int32.Parse(progressDiv.FindElements(By.TagName("span"))[1].Text);
                }
                catch (FormatException)
                {
                    currentAnime.TotalEpisodes = int.MaxValue;
                }
                animes.Add(currentAnime);
            }
            IsSignedIn = IsLoggedIn();
            FindAltName(animeUrls, animes);

            return(animes);
        }