예제 #1
0
        public MuzoFon(Main_Form form)
        {
            mainForm = form;

            ChromeOptions       options = new ChromeOptions();
            ChromeDriverService service = ChromeDriverService.CreateDefaultService();

            service.HideCommandPromptWindow = true;
            Browser = new ChromeDriver(service, options);
            Browser.Manage().Window.Minimize();

            PageHome   = new PageHomeMuzoFon(Browser);
            PageSport  = new PageSportMuzoFon();
            PageSearch = new PageSearchMuzoFon(Browser);

            ListMood               = new List <IWebElement>();
            ListGenre              = new List <IWebElement>();
            ListArtists            = new List <IWebElement>();
            ListTracks             = new List <IWebElement>();
            ListDurations          = new List <IWebElement>();
            ListDownloads          = new List <IWebElement>();
            ListPlays              = new List <IWebElement>();
            ListTrackOptions       = new List <TrackOptions>();
            ListSelectTrackOptions = new List <TrackOptions>();
        }
예제 #2
0
        /// <summary>
        /// Загрузка информации со страницы поиска.
        /// </summary>
        /// <returns>Возвращает список с элементами из результатов поиска.</returns>
        private List <TrackOptions> LoadTracksFromSite()
        {
            if (pageSearchMuzoFon == null)
            {
                pageSearchMuzoFon = new PageSearchMuzoFon(browser);
            }

            listArtists  = browser.FindElements(pageSearchMuzoFon.TextArtistBy).ToList();
            listTracks   = browser.FindElements(pageSearchMuzoFon.TextTrackBy).ToList();
            listDuration = browser.FindElements(pageSearchMuzoFon.TextDurationBy).ToList();
            listDownload = browser.FindElements(pageSearchMuzoFon.IconDownloadBy).ToList();

            for (int i = 0; i < listArtists.Count; i++)
            {
                TrackOptions trackOptions = new TrackOptions(
                    i,
                    listArtists[i].Text,
                    listTracks[i].Text,
                    listDuration[i].Text,
                    listDownload[i].GetAttribute("href"),
                    "not defined");
                listTrackOptions.Add(trackOptions);
            }

            return(listTrackOptions);
        }