Beispiel #1
0
        public void Initialize()
        {
            var root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            autoweb = new PageCollection();
            autoweb.OpenBrowser(Constants.TemplateFile);
        }
Beispiel #2
0
        public void TestBrowserNavigation()
        {
            using var local = new PageCollection();
            local.OpenBrowser(Constants.TemplateFile);

            var url = Path.GetFullPath(local.Browser.Url.Replace("file:///", ""));

            Assert.IsTrue(url == Constants.TemplateFile);
        }
Beispiel #3
0
        public void TestIfBrowserOpensAndCloses()
        {
            var local = new PageCollection();

            local.OpenBrowser();
            var process = Process.GetProcessesByName("msedgedriver");

            Assert.IsNotNull(process);
            Assert.IsTrue(process.Length == 1);

            local.Dispose();
            Assert.IsTrue(process[0].HasExited);
        }
Beispiel #4
0
        public void TestBrowserTryWaitFor()
        {
            using var local = new PageCollection();
            local.OpenBrowser(Constants.TemplateFile);

            var noElement = local.Browser.TryWaitFor(Where.Id, "no-element-exists", out IHtmlElement element2);

            Assert.IsFalse(noElement);
            Assert.IsNull(element2);


            var found = local.Browser.TryWaitFor(Where.Id, "hidden-for-3-seconds", out IHtmlElement element3);

            Assert.IsTrue(found);
            Assert.IsNotNull(element3);
        }
Beispiel #5
0
        public void TestAlternativeBrowserChrome()
        {
            var local = new PageCollection(options =>
            {
                options.Browser <ChromeBrowser>("chromedriver.exe");
            });

            local.OpenBrowser();

            var process = Process.GetProcessesByName("chromedriver");

            Assert.IsNotNull(process);
            Assert.IsTrue(process.Length == 1);

            local.Dispose();
            Assert.IsTrue(process[0].HasExited);
        }