Esempio n. 1
0
        /// <summary>
        /// attempts to get current points from the dashboard page
        /// </summary>
        /// <returns></returns>
        private DashboardData GetDashBoardData()
        {
            Logger.Instance.LogMethodStart();

            Thread.Sleep(1500);
            NavigateToUrl(_browserDriverCurrentSearchUser, "https://www.bing.com/rewards/dashboard", _minWait, true);

            DashboardData dashboardData = new DashboardData(_browserDriverCurrentSearchUser);

            return(dashboardData);
        }
Esempio n. 2
0
        private void DoSearch()
        {
            DashboardData dashboardData = _dashboardData;

            Logger.Instance.LogMethodStart();
            Random rand        = new Random((int)DateTime.Now.Ticks);
            int    counter     = 1;
            int    searchLimit = dashboardData.NumberOfSearchesRequiredForToday + 1;

            Logger.Instance.Log(string.Format("Performing {0} searches", searchLimit));

            NavigateToUrl(_browserDriverCurrentSearchUser, "http://www.bing.com/", _minWait);

            while (counter <= searchLimit)
            {
                string      term  = _searchTerms[_currentSearchTermIndex];
                IWebElement query = _browserDriverCurrentSearchUser.FindElement(By.Name("q")); //config

                query.Clear();
                query.SendKeys(string.Format("{0}", term));
                query.SendKeys(Keys.Enter);

                int waitTime = rand.Next(_minWait, _maxWait);

                int currentPoints = GetCurrentPoints(_appSettings["BindPointsDivId"]);

                WriteToConsoleAndClear(string.Format("[{0}] pausing {{0}} seconds. Points: {1}                             ", counter, currentPoints), waitTime);

                counter++;
                _currentSearchTermIndex++;
                if (_currentSearchTermIndex >= _searchTerms.Count)
                {
                    _currentSearchTermIndex = 0;
                }
            }

            Logger.Instance.Log("Search complete.");
        }