コード例 #1
0
        public void ClickAnElement()
        {
            // Launch an instance of the browser
            Manager.LaunchNewBrowser();
            // Some test cases may require that all cookies be cleared ahead of time.
            // WebAii does not care but depending on your environment and your specific
            // test case you may care.
            ActiveBrowser.ClearCache(ArtOfTest.WebAii.Core.BrowserCacheType.Cookies);
            // Navigate to the test page
            ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE));

            // Find the elements on the page using the Find.BYxxx methods.
            Element toggleOn  = Find.ById("btn1");
            Element toggleOff = Find.ById("btn2");

            // Now click the toggleOn button.
            Actions.Click(toggleOn);

            // Now click the toggleOff button.
            Actions.Click(toggleOff);

            // Now click the link
            Actions.Click(Find.ByTagIndex("a", 0));
            Assert.IsTrue(ActiveBrowser.Url.Contains("google"));

            // DO ANY TEST VERIFICATION HERE
        }
コード例 #2
0
 public void PopupsAndDialogs_CodedStep()
 {
     // 'Restore' the browser.
     ActiveBrowser.Window.Restore();
     // Clear Browser Cache
     if (ActiveBrowser.BrowserType.ToString() == "Safari")
     {
         Log.WriteLine("skip step for Safari");
     }
     else
     {
         ActiveBrowser.ClearCache(ArtOfTest.WebAii.Core.BrowserCacheType.Cookies);
         ActiveBrowser.ClearCache(ArtOfTest.WebAii.Core.BrowserCacheType.TempFilesCache);
         ActiveBrowser.ClearCache(ArtOfTest.WebAii.Core.BrowserCacheType.History);
     }
     // Navigate to : 'http://at-hyperv01/SampleWebsite/'
     ActiveBrowser.NavigateTo("http://at-hyperv01/js/dialogs.html", true);
 }