示例#1
0
        public void Initialize(SCore.Selenium browser, string url)
        {
            _browser = browser;

            _browser.Initialize();

            _browser.Navigation.OpenUrl(url);
        }
示例#2
0
        public void FindElementByClassName_InPage_ElementNotFound(SCore.Selenium browser)
        {
            // Arrange
            Initialize(browser);

            // Act
            var element = browser.Element.FindElementByClassName(_classNotFound);

            // Assert
            Assert.True(element == null);
        }
示例#3
0
        public void FindElementByClassName_InPage_ReturnsTheElement(SCore.Selenium browser)
        {
            // Arrange
            Initialize(browser);

            // Act
            var element = browser.Element.FindElementByClassName(_class);

            // Assert
            Assert.True(element != null);
        }
示例#4
0
        public void GetCurrentUrl_InPage_CheckIfTheCurrentURLIsThatItWasOpen(SCore.Selenium browser)
        {
            Initialize(browser);

            // Arrange
            string currentUrl;

            // Act
            browser.Navigation.OpenUrl(_url);
            currentUrl = browser.Navigation.GetCurrentUrl();

            // Assert
            Assert.True(currentUrl.NormalizeUrl() == _url.NormalizeUrl());
        }
示例#5
0
        public void CloseWebBrowser(SCore.Selenium browser)
        {
            Initialize(browser);

            // Arrange
            string currentUrl;

            // Act
            browser.Navigation.OpenUrl(_url);
            browser.Navigation.CloseWebBrowser();
            currentUrl = browser.Navigation.GetCurrentUrl();

            // Assert
            Assert.True(currentUrl.NormalizeUrl() == "about:blank");
        }
示例#6
0
        public void Click_InPage_ClickInTheButton(SCore.Selenium browser)
        {
            // Arrange
            var button = By.ClassName(_button);
            var resultUrl = @"https://login.live.com/login.srf";
            string currentUrl;
            Initialize(browser, _url2);

            // Act
            browser.Element.Click(button);
            currentUrl = browser.Navigation.GetCurrentUrl();

            // Assert
            Assert.True(currentUrl.NormalizeUrl() == resultUrl.NormalizeUrl());
        }
示例#7
0
        public void NavigateBack(SCore.Selenium browser)
        {
            Initialize(browser);

            // Arrange
            string currentUrl;
            var secondUrl = "google.com.br";

            // Act
            browser.Navigation.OpenUrl(_url);
            browser.Navigation.OpenUrl(secondUrl);
            browser.Navigation.NavigateBack();
            currentUrl = browser.Navigation.GetCurrentUrl();

            // Assert
            Assert.True(currentUrl.NormalizeUrl() == _url.NormalizeUrl());
        }
示例#8
0
 public void Initialize(SCore.Selenium browser)
 {
     Initialize(browser, _url);
 }
示例#9
0
        public void OpenUrl_InPage_OpenTheNewPage(SCore.Selenium browser)
        {
            Initialize(browser);

            // Arrange
            string currentUrl;

            // Act
            browser.Navigation.OpenUrl(_url);
            currentUrl = browser.Navigation.GetCurrentUrl();

            // Assert
            Assert.True(currentUrl.NormalizeUrl() == _url.NormalizeUrl());
        }
示例#10
0
        public void Submit_InPage_LogInToSystem(SCore.Selenium browser)
        {
            // Arrange
            var button = By.Id("idSIButton9");
            var txtLogin = By.Name("loginfmt");
            var txtPasswd = By.Name("passwd");
            var valLogin = "******";
            var valPass = "******";
            string currentUrl;
            string resultUrl = @"http://account.microsoft.com";
            Initialize(browser, @"https://login.live.com/login.srf");

            // Act
            browser.Element.SendKeys(txtLogin, valLogin);
            browser.Element.SendKeys(txtPasswd, valPass);
            browser.Element.Click(button);
            currentUrl = browser.Navigation.GetCurrentUrl();

            // Assert
            Assert.True(resultUrl.Normalize() == currentUrl.NormalizeUrl());
        }
示例#11
0
        public void SendKeys_InPage_WriteLogin(SCore.Selenium browser)
        {
            Initialize(browser, @"https://login.live.com/login.srf");

            // Arrange
            var txtLogin = By.Name("loginfmt");
            var valLogin = "******";

            // Act
            browser.Element.SendKeys(txtLogin, valLogin);

            // Assert
            Assert.True(browser.Element.GetValue(txtLogin) == valLogin);
        }
示例#12
0
        public void SelectDropDownByValue_InDDL_SelectTheBRLValue(SCore.Selenium browser)
        {
            Initialize(browser, @"https://www.paypal.com/us/webapps/mpp/home");

            // Arrange
            var passo1 = By.Id("header-send");
            var dropDown = By.Id("currency_code");
            string value;

            // Act
            browser.Element.Click(passo1);
            browser.Element.SelectDropDownByValue(dropDown, "BRL");
            value = browser.Element.GetValue(dropDown);

            // Assert
            Assert.True(value == "BRL");
        }
示例#13
0
        public void GetValue_InPage_GetTheValueOfTheLoginField(SCore.Selenium browser)
        {
            Initialize(browser, @"https://login.live.com/login.srf");

            // Arrange
            var txtLogin = By.Name("loginfmt");
            var valLogin = "******";
            string attr;

            // Act
            browser.Element.SendKeys(txtLogin, valLogin);
            attr = browser.Element.GetValue(txtLogin);

            // Assert
            Assert.True(attr == valLogin);
        }
示例#14
0
        public void FindElement_InPage_ReturnsTheElement(SCore.Selenium browser)
        {
            // Arrange
            var id = By.Id(_elementId);
            Initialize(browser);

            // Act
            var element = browser.Element.FindElement(id);

            // Assert
            Assert.True(element != null);
        }
示例#15
0
        public void FindElement_InPage_ElementNotFound(SCore.Selenium browser)
        {
            // Arrange
            var id = By.Id(_elementIdNotFound);
            Initialize(browser);

            // Act
            var element = browser.Element.FindElement(id);

            // Assert
            Assert.True(element == null);
        }