예제 #1
0
        public void GotoHTMLControls()
        {
            string       HTMLControlFile = "file://" + TestResources.GetTestResourcesFile("HTMLControls.html");
            GingerAction GA1             = new GingerAction();

            mSeleniumDriver.Navigate(GA1, HTMLControlFile);
        }
예제 #2
0
 public void Sample_VerifyBingTitle()
 {
     TestContext.WriteLine("Started Test");
     SeleniumDriver.Navigate().GoToUrl("https://bing.com/");
     Assert.IsTrue(SeleniumDriver.Title.Equals("Bing"));
     TestContext.WriteLine("Ended Test");
 }
예제 #3
0
 //TODO: check this form
 public void NavigateTo(string url)
 {
     if (Uri.TryCreate(url, UriKind.Absolute, out var absolute))
     {
         SeleniumDriver.Navigate().GoToUrl(url);
     }
     else
     {
         SeleniumDriver.Navigate().GoToUrl(RootUrl().AbsoluteUri + url);
     }
 }
        public void CoupaHomePage_SolutionsPage()
        {
            TestContext.WriteLine("Launch Coupa Home Page");
            SeleniumDriver.Navigate("https://www.coupa.com/");

            //Navigate to Solutions Link
            var solutionsLink = SeleniumDriver.Driver.FindElement(By.XPath("//a[contains(@href,'solutions')]"));

            solutionsLink.SendKeys(Keys.Enter);

            string expectedText     = "SPEND MANAGEMENT SOLUTIONS THAT WILL CHANGE YOUR BUSINESS";
            var    textOnWebElement = SeleniumDriver.Driver.FindElement(By.TagName("h1"));

            Assert.AreEqual(textOnWebElement.Text, expectedText);
            textOnWebElement.Text.Equals(expectedText, StringComparison.OrdinalIgnoreCase).Should().BeTrue();
            textOnWebElement.Text.Should().Be("SPEND MANAGEMENT SOLUTIONS THAT WILL CHANGE YOUR BUSINESS");
        }
예제 #5
0
        //TODO: check this form
        // I suspect this is an Async call, and there is no way to await :/
        public void NavigateTo(string url)
        {
            if (Uri.TryCreate(url, UriKind.Absolute, out var absolute))
            {
                SeleniumDriver.Navigate().GoToUrl(url);
            }
            else
            {
                SeleniumDriver.Navigate().GoToUrl(RootUrl().AbsoluteUri + url);
            }

            //safety, it is not it's job to catch this error
            try
            {
                Thread.Sleep(1000);
                WebDriverWait wait = new WebDriverWait(SeleniumDriver, new TimeSpan(0, 0, 5));
                wait.Until(x => x.FindElement(By.XPath("//body")));
            }
            catch { }
        }
예제 #6
0
 public void LoadPage(string html)
 => SeleniumDriver.Navigate().GoToUrl(
     "data:text/html;base64," +
     Convert.ToBase64String(Encoding.UTF8.GetBytes(html)));
예제 #7
0
 public void Sample_NavigateToTOI()
 {
     TestContext.WriteLine("Started Test");
     SeleniumDriver.Navigate().GoToUrl("https://timesofindia.indiatimes.com/");
     TestContext.WriteLine("Ended Test");
 }
예제 #8
0
 public void Sample_NavigateToGoogle()
 {
     TestContext.WriteLine("Started Test");
     SeleniumDriver.Navigate().GoToUrl("http://google.com/");
     TestContext.WriteLine("Ended Test");
 }
예제 #9
0
        public override async Task DoAction()
        {
            /*string address = Config.Instance.GetSection("Adress").Value + "api/accounts";
             * Log.Debug(address);
             * var addressUri = new Uri(address);
             * using (HttpClient client = new HttpClient())
             * {
             *  using (HttpResponseMessage response = await client.GetAsync(addressUri))
             *  {
             *      response.EnsureSuccessStatusCode();
             *      JToken jsonResponse = JToken.Parse(await response.Content.ReadAsStringAsync());
             *      ;
             *      if (jsonResponse.Value<int>("count") > 0)
             *      {
             *
             *      }
             *      Log.Debug(jsonResponse.ToString());
             *  }
             * }*/

            SeleniumDriver.Navigate().GoToUrl("https://www.facebook.com");
            Progress.Set("website", 60);

            // Zamykanie modala z cookies
            Wait.Until(driver => driver.FindElement(By.XPath("//button[@data-testid='cookie-policy-banner-accept']")).Displayed);
            SeleniumDriver.FindElement(By.XPath("//button[@data-testid='cookie-policy-banner-accept']")).Click();
            Progress.Set("website", 65);

            // email input
            Wait.Until(driver => driver.FindElement(By.Id("email")).Displayed);
            SeleniumDriver.FindElement(By.Id("email")).SendKeys("*****@*****.**");

            // password input
            Wait.Until(driver => driver.FindElement(By.Id("pass")).Displayed);
            SeleniumDriver.FindElement(By.Id("pass")).SendKeys("8JEFRgUS7qHfiA2!49#");

            // login btn
            Wait.Until(driver => driver.FindElement(By.XPath("//button[@name='login']")).Displayed);
            SeleniumDriver.FindElement(By.XPath("//button[@name='login']")).Click();
            Progress.Set("website", 70);

            // Sprawdzamy czy strona sie zalogowala jezeli tak to przenonisimy na profil
            Wait.Until(driver => driver.FindElement(By.XPath("//div[@id='toolbarContainer']")));
            SeleniumDriver.Navigate().GoToUrl(Url);
            Progress.Set("website", 75);

            // Klikamy w przycisk napisz wiadomosc
            Wait.Until(driver => driver.FindElement(By.XPath("//a[@data-loggable='ProfileHighQualityLogger']")).Displayed);
            SeleniumDriver.FindElement(By.XPath("//a[@data-loggable='ProfileHighQualityLogger']")).Click();
            Progress.Set("website", 80);

            // Klikamy w pole do pisania
            Wait.Until(driver => driver.FindElement(By.XPath("//div[@style='min-height: 16px;']")).Displayed);
            SeleniumDriver.FindElement(By.XPath("//div[@style='min-height: 16px;']")).Click();
            Progress.Set("website", 85);

            string[] messages = { "Siema", "Co robisz?", "Chuju odpisz", "jan pawel 2 gwalcil male dzieci", "Jebać cie", "chcesz cos z ivonu?" };
            var      random   = new Random();

            // Piszemy i wysylamy
            for (int i = 0; i < 10; i++)
            {
                int msgIndex = random.Next(messages.Length);
                Send(messages[msgIndex]);
                Thread.Sleep(2000);
            }

            Progress.Set("website", 90);
            Thread.Sleep(5000);
            SeleniumDriver.Close();
            Progress.Set("website", 95);
        }
예제 #10
0
 public void LoadPage(string html)
 => SeleniumDriver.Navigate().GoToUrl("data:text/html;charset=utf-8," + html);