Ejemplo n.º 1
0
        public void XSSAttack()
        {
            FirefoxDriver ffox = new FirefoxDriver();

            ffox.Navigate().GoToUrl("localhost:58374/safeinsert.aspx");
            ffox.FindElementById("sname").SendKeys("23',3);<script>document.body.setAttribute('style','background-image: url(\"http://vignette1.wikia.nocookie.net/simpsons/images/7/7b/Eat_My_Shorts.jpg/revision/latest?cb=20100606181712\");');</script>--");
            ffox.FindElementById("sgpa").SendKeys("2.0");
            ffox.FindElementById("InsertStudent").Click();

            ffox.Navigate().GoToUrl("localhost:58374/unsafeshowall.aspx");
            Assert.IsTrue(ffox.FindElementByTagName("body").GetAttribute("style").Contains("url(\"http://vignette1.wikia.nocookie.net/simpsons/images/7/7b/Eat_My_Shorts.jpg/revision/latest?cb=20100606181712"),"XSS Script failed to change background image");

            ffox.Navigate().GoToUrl("localhost:58374/safeshowall.aspx");
            Assert.IsFalse(ffox.FindElementByTagName("body").GetAttribute("style").Contains("url(\"http://vignette1.wikia.nocookie.net/simpsons/images/7/7b/Eat_My_Shorts.jpg/revision/latest?cb=20100606181712"),"SafeShowAll page failed in preventing background image from being injected");
        }
Ejemplo n.º 2
0
 public void Test3()
 {
     var driver = new FirefoxDriver();
     driver.Navigate().GoToUrl("http://www.baidu.com");
     //driver.FindElement(By.LinkText("登录")).Click();
     driver.FindElementById("lb").Click();
 }
        //log in
        public static void logIn(FirefoxDriver driver)
        {
            if (checkForLogin (driver))
                logOut(driver);

            Console.WriteLine ("Please enter your email address");
            FirefoxWebElement email = driver.FindElementById ("email");
            email.Click ();
            email.SendKeys (Console.ReadLine ());

            Console.WriteLine ("Please enter your password");
            FirefoxWebElement password = driver.FindElementById ("pass");
            password.Click ();
            password.SendKeys (Console.ReadLine ());

            password.SendKeys(Keys.Enter);
        }
 public void Test1()
 {
     var driver = new FirefoxDriver();
     driver.Navigate().GoToUrl("http://www.qtptutorial.net/automation-practice");
     driver.Manage().Window.Maximize();
     driver.FindElementById("idExample").Click();
     var elementCheck = driver.FindElementByXPath("//p[contains(text(),'Button success')]").Displayed;
     Assert.IsTrue(elementCheck, "Element was not present");
 }
 //log out
 public static void logOut(FirefoxDriver driver)
 {
     if (checkForLogin (driver)) {
         driver.FindElementById ("userNavigationLabel").Click();
         driver.FindElementByXPath ("/html/body/div[2]/div/div/div/div/div[1]/div/div/ul/li[12]/a/span/span").Click ();
         return;
     }
     return false;
 }
Ejemplo n.º 6
0
        public void SearchTest()
        {
            //Navigate to google
            var driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://google.com");

            //type text
            var searchbox = driver.FindElementById("gbqfq");
            searchbox.SendKeys("selenium");
            //click search
            var searchBtn = driver.FindElementById("gbqfb");
            searchBtn.Click();

            //check results
            try
            {
                var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
                wait.Until(ExpectedConditions.ElementExists(By.Id("rso"))); //rso is list of results id
                var list = driver.FindElementById("rso");

                //find selenium website
                var results = list.FindElements(By.ClassName("vurls"));
                foreach (var result in results)
                {
                    if (result.Text == "www.seleniumhq.org/")
                    {
                        //website found
                        Assert.IsTrue(true);
                        driver.Quit();
                        return;
                    }
                }
                //website not found
                Assert.IsTrue(false);
            }
            catch (WebDriverTimeoutException e)
            {
                Assert.Fail("No results found");
            }
            //I am lazy to close windows :)
            driver.Quit();
        }
 public void ThenIFindThoseItemsOnTheStartPage(int numberOfItems)
 {
     var storePage = "http://localhost:8717/";
     using (var driver = new FirefoxDriver())
     {
         driver.Navigate().GoToUrl(storePage);
         var itemsOnPage = driver.FindElementById("itemCount").Text;
         Assert.AreEqual(numberOfItems.ToString(), itemsOnPage);
         driver.Quit();
     }
 }
Ejemplo n.º 8
0
        public void injectionAttack()
        {
            FirefoxDriver ffox = new FirefoxDriver();

            ffox.Navigate().GoToUrl("localhost:58374/safeinsert.aspx");
            ffox.FindElementById("sname").SendKeys("Bart Simpson',4);delete from students where name='Bart Simpson';update students set gpa = 4;--");
            ffox.FindElementById("sgpa").SendKeys("2.0");
            ffox.FindElementById("InsertStudent").Click();

            DataTable results = ServerConn.MyQuery("SELECT * FROM students");

            bool InjectionFailed = false;

            foreach (DataRow d in results.Rows)
            {
                if (d.ItemArray[1].Equals("Bart Simpson',4);delete from students where name='Bart Simpson';update students set gpa = 4;--"))
                    InjectionFailed = true;
            }

            Assert.IsTrue(InjectionFailed, "Error: Safe insert did not prevent the SQL injection");

            ffox.Navigate().GoToUrl("localhost:58374/unsafeinsert.aspx");
            ffox.FindElementById("sname").SendKeys("Bart Simpson',4);delete from students where name='Bart Simpson';update students set gpa = 4;--");
            ffox.FindElementById("sgpa").SendKeys("4.0");
            ffox.FindElementById("InsertStudent").Click();

            results = ServerConn.MyQuery("SELECT * FROM students");
            foreach (DataRow d in results.Rows)
            {
                Assert.AreEqual((float) 4, (float) d.ItemArray[2], "Error: Student {0} does not have a GPA of 4", d.ItemArray[1].ToString());
                Assert.AreNotEqual("Bart Simpson", d.ItemArray[1].ToString(), "Error you didn't cover your tracks!");
            }
        }
Ejemplo n.º 9
0
        public void LoadPage()
        {
            var driver = new FirefoxDriver();
            driver.Url = "http://www.reallysimpleabtesting.co.uk//";

            var element = driver.FindElementByClassName("test");

            var message = element.Text;

            Console.WriteLine(message);

            if (message.Contains("call to action"))
            {
                if (Chance.FlipACoin())
                {
                    var link = driver.FindElementById("calltoaction");
                    link.Click();
                }
            }

            driver.Close();
        }
Ejemplo n.º 10
0
 private void SubmitTestPayment(FirefoxDriver seleniumInstance,Order originalOrder, string paymentUrl)
 {
     seleniumInstance.Url = paymentUrl;
     seleniumInstance.FindElementById("Email").SendKeys("*****@*****.**");
     AssertOrderAddress(seleniumInstance, originalOrder);
     var continueButton = seleniumInstance.FindElementById("btnAddressEntered") as IWebElement;
     continueButton.ClickWithJavascript(seleniumInstance);
 }
Ejemplo n.º 11
0
 public static bool DoesPageExist(FirefoxDriver driver, string pageName)
 {
     GotoPage(driver, pageName);
     bool exists = false;
     try
     {
         IWebElement pageTitle = null;
         PerformActionWithRetry(() => { pageTitle = driver.FindElementById("title-text"); });
         // Space Tools is the page to recover a deleted page.
         exists = pageTitle.Text != "Page Not Found" && pageTitle.Text != "Space Tools";
         if (exists)
         {
             // in case the page is in another space.
             // confluence shows the title with the correct page name
             // but the page does not exist.
             exists = driver.FindElementByCssSelector("div#content div.aui-message p.title").Text != "Page Not Found";
         }
     }
     catch
     {
         // ignored
     }
     return exists;
 }
Ejemplo n.º 12
0
 public void initializeWebDriver()
 {
     var path = @"C:\Users\Witold\AppData\Roaming\Mozilla\Firefox\Profiles\243mda9k.Selenium";
     var ffProfile = new FirefoxProfile(path, false);
     driver = new FirefoxDriver(ffProfile);
     driver.Navigate().GoToUrl("https://steamcommunity.com/login/home/?goto=0");
     Thread.Sleep(1000);
     var userNameField = driver.FindElementById("steamAccountName");
     var userPasswordField = driver.FindElementById("steamPassword");
     var loginButton = driver.FindElementById("SteamLogin");
     userNameField.SendKeys(SteamCredentials.login);
     userPasswordField.SendKeys(SteamCredentials.password);
     loginButton.Click();
     Thread.Sleep(1000);
 }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            RemoteWebDriver browser = new FirefoxDriver();

            try
            {
                browser.Navigate().GoToUrl("http://alitrack.ru/");

                #region Login
                if (browser.FindElementByName("login") != null)
                {
                    browser.FindElementByName("login").SendKeys(cabinet.alitrack.ru.Properties.Settings.Default.UserName);
                    browser.FindElementByName("pass").SendKeys(cabinet.alitrack.ru.Properties.Settings.Default.Password);
                    browser.FindElementByXPath("//input[@type='submit']").Click();
                }
                #endregion

                WaitForCompleteXPath(browser, "//a[contains(@href,'tracking')]");
                browser.Navigate().GoToUrl("http://cabinet.alitrack.ru/tracking/");
                WaitForCompleteXPath(browser, "//a[contains(@href,'tracking')]");


                if (browser.PageSource.Contains("trackingCheckAllItems"))
                {
                    #region update
                    browser.FindElementById("trackingCheckAllItems").Click();
                    var alert = browser.SwitchTo().Alert();
                    alert.Accept();
                    WaitForCompleteXPath(browser, "//div[@id='processingWindow' and contains(@style,'display: none;')]");
                    var trackingRows = browser.FindElementsByClassName("tracking-row");

                    foreach (var trackingRow in trackingRows)
                    {
                        Console.WriteLine(trackingRow.FindElement(By.ClassName("name")).Text);
                        string number = trackingRow.GetAttribute("id").Replace("trow", string.Empty);
                        if (browser.PageSource.Contains(string.Format("id=\"refresh-button{0}\"", number)))
                        {
                            browser.FindElementById("refresh-button" + number).Click();
                            WaitForCompleteXPath(browser, "//div[@id='processingWindow' and contains(@style,'display: none;')]");
                        }
                    }
                    #endregion

                    #region find new
                    browser.Navigate().GoToUrl("http://cabinet.alitrack.ru/tracking/");
                    WaitForCompleteXPath(browser, "//a[contains(@href,'tracking')]");
                    var trackingNewRows = browser.FindElementsByClassName("tracking-row");
                    Regex regexButtons = new Regex("<div[^>]*class=\"buttons\"[^>]*>(.*?)</div>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Regex regexFull = new Regex("<div[^>]*class=\"fullinfo\"[^>]*>(.*?)</div>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    int newCount = 0;
                    StringBuilder newItems = new StringBuilder();
                    foreach (var trackingRow in trackingNewRows)
                    {
                        Console.WriteLine(trackingRow.FindElement(By.ClassName("name")).Text);
                        if (!string.IsNullOrEmpty(trackingRow.FindElement(By.ClassName("newSteps")).Text))
                        {
                            newCount++;
                            newItems.AppendLine(regexFull.Replace(regexButtons.Replace(trackingRow.GetAttribute("outerHTML"), string.Empty), string.Empty));
                        }
                    }
                    #endregion

                    if (newCount > 0)
                    {
                        #region Processing
                        newItems.Replace("class=\"clear\"", "style=\"clear: both;\"");
                        newItems.Replace("class=\"newSteps\"", "style=\"font-size: 11px;font-weight: normal;color: #a00;display: inline-block;padding: 0 0 0 4px;margin: -5px 0 0 0;vertical-align: top;\"");
                        newItems.Replace("class=\"info\"", "style=\"padding: 0;	overflow: hidden;	white-space: nowrap;color: #50749b;\"");
                        newItems.Replace("class=\"meta\"", "style=\"padding: 3px 0 0 0;	display:inline-block;overflow: hidden;color: #97adc3;white-space: nowrap;\"");
                        newItems.Replace("class=\"name\"", "style=\"font-size: 18px; padding: 9px 0 5px 0; overflow: hidden; color: #50749b; cursor: pointer; white-space: nowrap;\"");

                        newItems.Replace("class=\"tracking-row hasmoves\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #d0e7ff;	border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row hasexport\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #bad2ff;	border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row haslong\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #c0b4ff;	border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row hascustom\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #e6ff8c;	border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row hasnotrace\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #ffc994; border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row hasnative\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #b3fab3;	border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row hasarrive\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #161; color: #b3fab3; border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row haswarning\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #ffd0d0; color: #50749B; border-radius: 5px;\"");
                        newItems.Replace("class=\"tracking-row hasrecieved\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #DDD;	border-radius: 5px;\"");


                        newItems.Replace("class=\"tracking-row\"", "style=\"font-family: Arial, Verdana, Tahoma; font-size: 12px; line-height: 1em; margin: 0 0 2px 0; background-color: #ebeff3; border-radius: 5px;\"");

                        newItems.Replace("class=\"main\"", "style=\"padding: 0 0 8px 8px; float: left; background-color: #ebeff3; border-radius: 0 5px 5px 0; cursor: pointer; position: relative;\"");
                        newItems.Replace("class=\"time\"", "style=\"font-size: 10px; line-height: 10px; color: #50749b; text-align: center; padding: 35px 0 0;\"");
                        newItems.Replace("class=\"icon\" style=\"", "style=\"float: left;width: 60px;height: 60px;border-radius: 5px 0 0 5px; overflow: hidden; cursor: default;background: url(trackicons/0.png) 14px 5px no-repeat;");
                        newItems.Replace(" class=\"infopos\"", string.Empty);
                        #endregion

                        #region Send report
                        string report = cabinet.alitrack.ru.Properties.Resources.Template.Replace("{NEW}", newItems.ToString());
                        SmtpClient client = new SmtpClient(cabinet.alitrack.ru.Properties.Settings.Default.SMTP);
                        MailAddress from = new MailAddress(cabinet.alitrack.ru.Properties.Settings.Default.EmailFrom);
                        MailAddress to = new MailAddress(cabinet.alitrack.ru.Properties.Settings.Default.EmailTo);
                        MailMessage message = new MailMessage(from, to);
                        message.Subject = string.Format("{0} new update from alitrack", newCount);
                        message.IsBodyHtml = true;
                        message.Body = report;
                        client.Send(message);
                        #endregion
                    }
                }                
            }
            catch(Exception e)
            {
                SmtpClient client = new SmtpClient(cabinet.alitrack.ru.Properties.Settings.Default.SMTP);
                MailAddress from = new MailAddress(cabinet.alitrack.ru.Properties.Settings.Default.EmailFrom);
                MailAddress to = new MailAddress(cabinet.alitrack.ru.Properties.Settings.Default.EmailTo);
                MailMessage message = new MailMessage(from, to);
                message.Subject = "new update from alitrack Exception";                
                message.Body = e.ToString();
                client.Send(message);
            }
            finally
            {
                browser.Quit();
            }
        }
Ejemplo n.º 14
0
        static void Main (string[] args)
        {
            // Checking for Input Parameters
            if (args == null || args.Length != 1)
            {
                Console.WriteLine ("Incorrect number of arguments received. Expected One");
                System.Environment.Exit (-100);
            }

            // Human Readable Variable
            string inputFile = args[0];

            // Checking if the Input file received exists
            if (!File.Exists (inputFile))
            {
                Console.WriteLine (String.Format("Received input file does not exist : {0}", inputFile));
                System.Environment.Exit (-101);
            }

            // App Status 
            _appStatus = new Dictionary<String, AppStatusModel> ();

            // Creating Instance of Database Manager
            MongoDBWrapper mongoDB   = new MongoDBWrapper ();
            string fullServerAddress = String.Join (":", Consts.MONGO_SERVER, Consts.MONGO_PORT);
            mongoDB.ConfigureDatabase (Consts.MONGO_USER, Consts.MONGO_PASS, Consts.MONGO_AUTH_DB, fullServerAddress, Consts.MONGO_TIMEOUT, Consts.MONGO_DATABASE, Consts.MONGO_COLLECTION);

            // Creating Instance of Parser
            PlayStoreParser dataParser = new PlayStoreParser ();

            goto PeopleData;

            using (WebRequests httpClient = new WebRequests ())
            {
                // Minor Configuration of the Http Client - Ensures that the requests response will be in english
                // By doing so, we have no problems parsing the dates to their proper formats
                httpClient.Headers.Add (Consts.ACCEPT_LANGUAGE);
                httpClient.Host     = Consts.HOST;
                httpClient.Encoding = "utf-8";
                httpClient.EncodingDetection = WebRequests.CharsetDetection.DefaultCharset;

                // Iterating over File Lines (App Urls) - To Extract Data, Not The Reviews Yet.
                foreach (string appUrl in File.ReadAllLines (inputFile))
                {
                    // Logging Progress
                    Console.WriteLine ("\n => Processing App : " + appUrl);

                    // Executing Http Get Request for the Apps's Data - With max of 5 Retries
                    String appDataResponse = String.Empty;
                    int currentRetry       = 0;

                    do
                    {
                        // Http Get
                        appDataResponse = httpClient.Get (appUrl);

                    } while (String.IsNullOrWhiteSpace(appDataResponse) || ++currentRetry <= _maxRetries);

                    // Sanity Check
                    if (String.IsNullOrWhiteSpace (appDataResponse))
                    {
                        Console.WriteLine ("\t\t.Error - Failed to find page of app : " + appUrl + ". Skipping it");
                        continue;
                    }

                    Console.WriteLine("\t\t.Page Found. Firing Parser");

                    // Parsing App Data
                    AppModel appData = dataParser.ParseAppPage (appDataResponse, appUrl);

                    // Checking If this app is on the database already
                    if (mongoDB.AppProcessed (appUrl))
                    {
                        Console.WriteLine ("\t\t.Previous Version of App Found. Updating It");
                        mongoDB.UpdateRecord (appData, "Url", appData.Url);

                        // Updating App Status
                        _appStatus.Add
                            (
                                appData.Url,
                                new AppStatusModel ()
                                {
                                    appId   = appData.Url.Replace (Consts.PLAY_STORE_PREFIX, String.Empty),
                                    appUrl  = appData.Url,
                                    appName = appData.Name,
                                    status  = "Updated"
                                }
                            );
                    }
                    else
                    {
                        Console.WriteLine ("\t\t.No Previous Version of the App Found. Adding to Database");
                        mongoDB.Insert<AppModel> (appData);

                        // Updating App Status
                        _appStatus.Add
                            (
                                appData.Url,
                                new AppStatusModel ()
                                {
                                    appId   = appData.Url.Replace (Consts.PLAY_STORE_PREFIX, String.Empty),
                                    appUrl  = appData.Url,
                                    appName = appData.Name,
                                    status  = "Inserted"
                                }
                            );
                    }
                }
            }

            Reviews:
            // Next Phase: Parse Reviews of those Apps
            Console.WriteLine ("\n => Parsing Complete. Obtaining Reviews");

            // Iterating again over app urls to parse the reviews from this app
            foreach (string appUrl in File.ReadAllLines (inputFile))
            {
                // Reaching App Id
                string appID = _appStatus[appUrl].appId;

                // Reviews-Break-Parsing Flag
                bool shouldContinueParsing = true;

                // Parsing Review Pages from the apps
                for (int currentPage = 1; /* no stop condition */; currentPage++)
                {
                    // Getting Reviews Data Bundle
                    string reviewsData = ReviewsWrapper.GetAppReviews (appID, currentPage);

                    // Checking for Blocking Situation
                    if (String.IsNullOrEmpty (reviewsData))
                    {
                        Console.WriteLine("Blocked by Play Store. Sleeping process for 10 minutes before retrying.");

                        // Thread Wait for 10 Minutes
                        Thread.Sleep (10 * 60 * 1000);
                    }

                    // Checking for "No Reviews" app
                    if (reviewsData.Length < 50)
                    {
                        Console.WriteLine ("No Reviews left for this app. Skipping");
                        break;
                    }

                    // Normalizing Response to Proper HTML
                    reviewsData = ReviewsWrapper.NormalizeResponse (reviewsData);

                    // Iterating over Parsed Reviews
                    foreach (var review in dataParser.ParseReviews (reviewsData))
                    {
                        // Adding App Data to the review
                        review.appID   = _appStatus[appUrl].appId;
                        review.appName = _appStatus[appUrl].appName;
                        review.appURL  = _appStatus[appUrl].appUrl;

                        // Incrementing Reviews Count for this app
                        _appStatus[appUrl].reviews++;

                        // Adding Review Object to Database
                        review.timestamp = DateTime.Now;

                        // Building Query to check for duplicated review
                        var duplicatedReviewQuery = Query.EQ ("permalink", review.permalink);

                        // Checking for duplicated review before inserting it
                        if (mongoDB.FindMatch<AppReview> (duplicatedReviewQuery, 1, 0, Consts.REVIEWS_COLLECTION).Count () == 0)
                        {
                            // Inserting Review into MongoDB
                            mongoDB.Insert<AppReview> (review, Consts.REVIEWS_COLLECTION);
                        }
                        else
                        {
                            Console.WriteLine ("Duplicated Review. Skipping App");

                            // When this happens, there are no more reviews to be parsed
                            shouldContinueParsing = false; // Skipping this apps processing
                        }
                    }

                    // Hiccup to avoid Blocking problems
                    Console.WriteLine ("Parsed Reviews: " + _appStatus[appUrl].reviews);
                    Thread.Sleep (new Random ().Next (14000, 21000));

                    if (!shouldContinueParsing)
                    {
                        break;
                    }
                }
            }

            PeopleData:

            Console.WriteLine ("\n\n => Processing People Data");

            Console.WriteLine ("\nSimulating Google Login Using Selenium.");
            using (var firefoxDriver = new FirefoxDriver ())
            {
                // Navigating to Dummy Url - One that I Know that well be asked for a login
                firefoxDriver.Navigate ().GoToUrl ("https://play.google.com/store/people/details?id=101242565951396343093");

                // Reaching Login Fields
                var loginField    = firefoxDriver.FindElementById ("Email");
                var passwordField = firefoxDriver.FindElementById ("Passwd");
                var btnSignIn     = firefoxDriver.FindElementById ("signIn");

                // Sending Credentials to the browser
                loginField.SendKeys ("YOUREMAIL");
                passwordField.SendKeys ("YOURPASSWORD");
                btnSignIn.Click ();

                string lastPeople = "https://play.google.com/store/people/details?id=115037241907660526856";
                bool shouldcontinue = false;

                // Processing Reviewers Data
                foreach (string peopleUrl in mongoDB.FindPeopleUrls ())
                {
                    // Skipping until last link
                    if (peopleUrl == lastPeople)
                    {
                        shouldcontinue = true;
                    }

                    if (!shouldcontinue) continue;

                    // Navigating To the Reviewer Page
                    firefoxDriver.Navigate ().GoToUrl (peopleUrl);

                    // Executing Get Request for the Reviewer page on Google Play
                    string reviewerPage = firefoxDriver.PageSource;

                    // Extracting Reviewer Data from the Page
                    ReviewerPageData reviewerData = dataParser.ParsePeopleData (reviewerPage);

                    // Adding Url to the model
                    reviewerData.reviewerUrl = peopleUrl;

                    // Inserting it to the database - If no previous record of this Reviewer is found
                    if (!mongoDB.IsReviewerOnDatabase (peopleUrl))
                    {
                        mongoDB.Insert<ReviewerPageData> (reviewerData, "ReviewersData");
                    }
                }
            }

            // End of Processing + Console Feedback
            Console.WriteLine ("\n\n == Processing Summary ==");

            foreach (var status in _appStatus.Select (t => t.Value))
            {
                // Message
                string cMessage = "=> App : {0} - Status {1} - Reviews : {2}";

                Console.WriteLine (String.Format (cMessage, status.appName, status.status, status.reviews));
            }

            Console.ReadLine ();
        }
Ejemplo n.º 15
0
 private void AddAddressAndSubmitTestPayment(FirefoxDriver seleniumInstance,Order originalOrder, string paymentUrl,string name,string address1,string townOrCity,string county)
 {
     seleniumInstance.Url = paymentUrl;
     seleniumInstance.FindElementById("Email").SendKeys("*****@*****.**");
     AssertOrderAddress(seleniumInstance, originalOrder);
     seleniumInstance.FindElementById("Name").SendKeys(name);
     seleniumInstance.FindElementById("Address1").SendKeys(address1);
     seleniumInstance.FindElementById("AddressTownOrCity").SendKeys(townOrCity);
     seleniumInstance.FindElementById("StateOrCounty").SendKeys(county);
     var continueButton = seleniumInstance.FindElementById("btnAddressEntered") as IWebElement;
     continueButton.ClickWithJavascript(seleniumInstance);
 }
Ejemplo n.º 16
0
 private void AssertOrderAddress(FirefoxDriver seleniumInstance, Order originalOrder)
 {
     AssertEqualOrBothNullOrEmpty(originalOrder.recipientName, seleniumInstance.FindElementById("Name").GetAttribute("value"));
     AssertEqualOrBothNullOrEmpty(originalOrder.address1, seleniumInstance.FindElementById("Address1").GetAttribute("value"));
     AssertEqualOrBothNullOrEmpty(originalOrder.address2, seleniumInstance.FindElementById("Address2").GetAttribute("value"));
     AssertEqualOrBothNullOrEmpty(originalOrder.addressTownOrCity, seleniumInstance.FindElementById("AddressTownOrCity").GetAttribute("value"));
     AssertEqualOrBothNullOrEmpty(originalOrder.stateOrCounty, seleniumInstance.FindElementById("StateOrCounty").GetAttribute("value"));
 }
Ejemplo n.º 17
0
 private void CheckOrderSummary(FirefoxDriver seleniumInstance)
 {
     //should charge vat
     var vatEl = seleniumInstance.FindElementByText("VAT");
     Assert.IsNotNull(vatEl);
     var totalEl = seleniumInstance.FindElementByText("£5.04");
     Assert.IsNotNull(totalEl,"Should have total cost of £5.04 on page");
     var continueButton = seleniumInstance.FindElementById("btnConfirmAndPay") as IWebElement;
     continueButton.ClickWithJavascript(seleniumInstance);
 }