Beispiel #1
0
        static void Main(string[] args)
        {
            SeleniumLog log = SeleniumLog.Instance(null);

            log.WriteLine("Launch Chrome");
            ChromeOptions options = new ChromeOptions();

            options.AddArgument("--start-maximized");
            int ExpectedCount = -1;
            int ActualCount   = -1;

            IWebDriver driver = new ChromeDriver(options);

            GumtreeWebsite.MainPage GumtreeMain = new GumtreeWebsite.MainPage(driver);


            log.WriteLine("Goto GUMTREE URL");

            driver.Navigate().GoToUrl("http://gumtree.com.au");

            log.WriteLine("Run Test");
            MainPage          MainPage          = new MainPage(driver);
            SearchResultsPage SearchResultsPage = new SearchResultsPage(driver);
            CarDetailsPage    CarDetailsPage    = new CarDetailsPage(driver);

            MainPage.Search("Toyota");

            log.WriteLine("Currently on Page 1 .....");

            ExpectedCount = SearchResultsPage.GetDisplayedResultsCountPerPage();
            log.WriteLine("Displayed results per page [" + ExpectedCount + "]");

            ActualCount = SearchResultsPage.CountSearchResults();
            log.WriteLine("Actual number of results [" + ActualCount + "]");

            log.WriteLine("Goto Page 2");
            SearchResultsPage.GotoPage(2);

            log.WriteLine("Goto Page 3");
            SearchResultsPage.GotoPage(3);

            log.WriteLine("Goto Page 4");
            SearchResultsPage.GotoPage(4);


            log.WriteLine("\n\n********** While on Page 4, click on random advert *******************");
            SearchResultsPage.ClickOnRandomSearchResult();
            CarDetailsPage.ClickImageButton();
            CarDetailsPage.CycleThroughAllImages();

            //Close Browser
            driver.Close();
            driver.Quit();
        }
Beispiel #2
0
        public void test()
        {
            try
            {
                SeleniumLog log = SeleniumLog.Instance();

                //ApiField.Click();
                //log.WriteLine("Field default text [" + ApiField.GetAttribute("placeholder") + "]");
                //ApiField.SendKeys("test");
                //SearchField.SendKeys("Toyota");
                //SearchButton.Click();
                //log.WriteLine("Ad count [" + AdsList.Count + "]");
                //log.WriteLine("Sleep 3 seconds");
                //Thread.Sleep(3000);
                //log.WriteLine("Finished sleeping");
                //ScrollIntoView(ResultsCount);

                log.WriteLine("end test");
            }
            catch (Exception e)
            {
                SeleniumLog log = SeleniumLog.Instance();
                log.Error().WriteLine("Exception: " + e.Message);
            }
        }
        static void Main(string[] args)
        {
            FirefoxDriver            driver0 = new FirefoxDriver();
            SeleniumLogEventListener driver  = new SeleniumLogEventListener(driver0);
            SeleniumLog log = SeleniumLog.Instance(driver);

            TestClass tobj = new TestClass();

            log.WriteLine("Main");
            Foo();
            tobj.Message("hi there");
        }
 public void Message(string msg)
 {
     try
     {
         SeleniumLog log = SeleniumLog.Instance();
         log.WriteLine(string.Format("TestClass :: Message :: {0}", msg));
     }
     catch (Exception e)
     {
         SeleniumLog log = SeleniumLog.Instance();
         log.Error().WriteLine(string.Format("TestClass :: Exception :: {0}", e.Message));
     }
 }
Beispiel #5
0
        public static void TestSimpleText()
        {
            SeleniumLog log = SeleniumLog.Instance();

            log.WriteLine("line 1");
            log.Indent().Indent().WriteLine("line 2");
            log.WriteLine("line 3");
            log.Indent().WriteLine("line 4");
            log.WriteLine("line 5");
            log.WriteLine("line 6");
            log.Indent().Pass().Blue().WriteLine("line 7");
            log.WriteLine("line 8");
            log.Unindent().Unindent().Unindent().WriteLine("line 9");
            log.WriteLine("line 10");
        }
        public void Run2()
        {
            FirefoxDriver            driver0 = new FirefoxDriver();
            SeleniumLogEventListener driver  = new SeleniumLogEventListener(driver0);
            //SeleniumEventListener driver = SeleniumLogEventListener(driver0);
            SeleniumHomePage          Home = new SeleniumHomePage(driver);
            SeleniumDocumentationPage Doc  = new SeleniumDocumentationPage(driver);
            SeleniumLog log = SeleniumLog.Instance(driver);

            log.WriteLine("Step 0: Display message");
            log.Indent();
            Home.Greeting1("Hi there");
            log.Unindent();

            log.WriteLine("Step 0.5: Display message");
            log.Indent();
            Doc.Greeting2("Hi there 2");
            log.Unindent();

            log.WriteLine("Step 1: Go to SeleniumHQ home page");
            driver.Navigate().GoToUrl("http://seleniumhq.org/");

            log.WriteLine("Step 2: Click on Documentation tab");
            Home.DocumentationTab.Click();

            log.WriteLine("Step 3: Click on Introduction link");
            Doc.Introduction.Click();

            log.WriteLine("Step 4: Click on Selenium Tool Suite link");
            Doc.SeleniumToolSuite.Click();

            log.WriteLine("Step 5: Click on Supported Browsers and Platforms link");
            Doc.SupportedBrowsersAndPlatforms.Click();

            log.WriteLine("complete.");
        }
        public void Run()
        {
            SeleniumLog log = SeleniumLog.Instance();

            log.WriteLine("Run: Start");
        }
        public void Greeting2(string message)
        {
            SeleniumLog log = SeleniumLog.Instance();

            log.WriteLine(message);
        }
        public void Method1(int A, int B, object ds)
        {
            SeleniumLog log = SeleniumLog.Instance();

            log.WriteLine("Hello World");
        }
Beispiel #10
0
        public static void TestIndentations()
        {
            SeleniumLog log = SeleniumLog.Instance();
            int         L   = 0;

            log.WriteLine("line 1");
            log.WriteLine("line 2");
            log.WriteLine("line 3");
            log.WriteLine("line 4");
            log.WriteLine("line 5");
            log.Indent();
            log.Indent();
            log.WriteLine("line 6");
            log.WriteLine("line 7");
            log.WriteLine("line 8");
            log.WriteLine("line 9");
            log.WriteLine("line 10");
            log.WriteLine("line 11");
            log.WriteLine("line 12");
            log.WriteLine("line 13");
            log.WriteLine("line 14");
            log.WriteLine("line 15");
            log.Indent();
            log.WriteLine("line 16");
            log.WriteLine("line 17");
            log.WriteLine("line 18");
            log.WriteLine("line 19");
            log.WriteLine("line 20");
            log.WriteLine("line 21");
            log.WriteLine("line 22");
            log.WriteLine("line 23");
            log.WriteLine("line 24");
            log.WriteLine("line 25");
            log.WriteLine("line 26");
            log.WriteLine("line 27");
            log.WriteLine("line 28");
            log.SaveIndent("id"); //
            log.Indent();
            log.WriteLine("line 29");
            log.WriteLine("line 30");
            log.WriteLine("line 31");
            log.WriteLine("line 32");
            log.WriteLine("line 33");
            log.WriteLine("line 34");
            log.WriteLine("line 35");
            log.WriteLine("line 36");
            log.Unindent().Unindent();
            log.WriteLine("line 37");
            log.WriteLine("line 38");
            log.Indent().WriteLine("line 39");
            log.WriteLine("line 40");
            log.Indent().WriteLine("line 41");
            log.WriteLine("line 42");
            log.WriteLine("line 43");
            log.Indent().WriteLine("line 44");
            log.Indent().WriteLine("line 45");
            log.WriteLine("line 46");
            log.WriteLine("line 47");
            log.Indent();
            log.WriteLine("line 48");
            log.WriteLine("line 49");
            log.WriteLine("line 50");
            log.WriteLine("line 51");
            log.WriteLine("line 52");
            log.WriteLine("line 53");
            log.WriteLine("line 54");
            log.WriteLine("line 55");
            log.WriteLine("line 56");
            log.WriteLine("line 57");
            log.WriteLine("line 58");
            log.WriteLine("line 59");
            log.WriteLine("line 60");
            log.WriteLine("line 61");
            log.Unindent().Unindent().Unindent();
            log.WriteLine("line 62");
            log.WriteLine("line 63");
            log.WriteLine("line 64");
            log.WriteLine("line 65");
            log.WriteLine("line 66");
            log.WriteLine("line 67");
            log.WriteLine("line 68");
            log.WriteLine("line 69");
            log.WriteLine("line 70");
            log.RestoreIndent("id");  //
            log.WriteLine("line 71");
            log.WriteLine("line 72");
            log.WriteLine("line 73");
            log.WriteLine("line 74");
            log.WriteLine("line 75");
            log.WriteLine("line 76");
            log.WriteLine("line 77");
            log.WriteLine("line 78");
            log.WriteLine("line 79");
            log.WriteLine("line 80");
            log.WriteLine("line 81");
            log.WriteLine("line 82");
            log.WriteLine("line 83");
            log.WriteLine("line 84");
            log.WriteLine("line 85");
            log.WriteLine("line 86");
            log.WriteLine("line 87");
            log.WriteLine("line 88");
            log.WriteLine("line 89");
            log.WriteLine("line 90");
            log.WriteLine("line 91");
            log.WriteLine("line 92");
            log.WriteLine("line 93");
            log.WriteLine("line 94");
            log.WriteLine("line 95");
            log.WriteLine("line 96");
            log.WriteLine("line 97");
            log.WriteLine("line 98");
            log.WriteLine("line 99");
            log.WriteLine("line 100");
        }
        public void Run()
        {
            SeleniumLog log = SeleniumLog.Instance();

            log.Path("TestCase 1: Site navigation");

            log.WriteLine("Step 1: Goto Seleniumlog.com website");
            log.Indent();
            Home.Goto();
            log.Unindent();

            //log.WriteLine("Step 2: Goto Buy Now page");
            //Home.BuyNow.Click();

            log.WriteLine("Step 3: Goto Contact Us page");
            Home.ContactUs.Click();

            Thread.Sleep(2000);

            log.WriteLine("Step 4: Enter First Name");
            Contact.FirstName.SendKeys("James");

            log.WriteLine("Step 5: Enter Last Name");
            Contact.LastName.SendKeys("Smith");

            log.WriteLine("Step 6: Enter Email address");
            Contact.Email.SendKeys("james.smith.seleniumlog.com");

            log.WriteLine("Step 7: Enter Comments");
            Contact.Comment.SendKeys("Hello World!");

            log.WriteLine("Step 8: Click on Submit button");
            Contact.Submit.Click();

            log.WriteLine("Step 9: Verify not submitted");
            log.Indent();
            Contact.VerifyNotSubmitted();
            log.Unindent();

            log.WriteLine("Step 10: Re-Enter Email address");
            Contact.Email.SendKeys("*****@*****.**");

            log.WriteLine("Step 11: Click on Submit button");
            Contact.Submit.Click();

            log.WriteLine("Step 12: Verify submitted successfully");
            log.Indent();
            Contact.VerifySubmitted();
            log.Unindent();
        }
        static void Foo()
        {
            SeleniumLog log = SeleniumLog.Instance();

            log.WriteLine("Message from Foo");
        }