コード例 #1
0
        public void SeletorPorClasse(string url, string id)
        {
            using var driver = Substitute.For <IWebDriver, IDisposable>();
            driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(2000);
            driver.Navigate().GoToUrl(url);

            var seletor = new IDSeletor(driver, id);

            var element = seletor.Seletor();

            Assert.NotNull(element);
        }
コード例 #2
0
        public void SeletorPorClasseNaoEncontrado(string url, string id)
        {
            using var driver = Substitute.For <IWebDriver, IDisposable>();
            driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(2000);
            driver.Navigate().GoToUrl(url);

            var seletor = new IDSeletor(driver, id);

            driver.FindElement(By.Id(id)).Returns(x => { throw new SeletorNaoEncontradoException(""); });
            Exception ex = Assert.Throws <SeletorNaoEncontradoException>(() => seletor.Seletor());

            Assert.IsType <SeletorNaoEncontradoException>(ex);
        }