public override void Setup() { _browser = new WebBrowser(_browserType); iBrowserInstance = ReflectionHelper.GetField<IBrowser>(_browser, "_browser"); _browser.OpenBrowser(); _browser.NavigateBrowser(getTestPage("SightLessUserTestPage.htm")); }
public void KeyboardCopyWorksTest() { browser = new WebBrowser(BrowserType.FireFox); IBrowser browserObj = (IBrowser) ReflectionHelper.GetField<object>(browser, "_browser"); KeyboardInput input = new KeyboardInput(browserObj); browser.OpenBrowser(); browser.NavigateBrowser("http://www.google.com"); input.Copy(GetTestWindowHandle("Google")); browser.KillAllOpenBrowsers(); }
public void SpecialCharactersReturnedFromAssertionJSSHTest() { const string elemValue = "Óúña¡í güeeÑe ÉtÜ"; WebBrowser browser = new WebBrowser(BrowserType.FireFox); browser.OpenBrowser(); string page = string.Format("http://{0}/swat/{1}", Environment.MachineName.ToLower(), "ElementsWithSpecialCharactersPage.htm"); browser.NavigateBrowser(page); try { browser.AssertElementExists(IdentifierType.Expression, "id=Unicode Character Test;value=" + elemValue, "input"); } finally { browser.CloseBrowser(); } }
public void SpecialCharactersReturnedFromBrowserTitleJSSHTest() { const string actualTitle = "ConfiguraciÓn salteña¡ krúss caffé¿ bahá'í güe Áetna eÑe Éthernet Ígloo Úruguay Über"; WebBrowser browser = new WebBrowser(BrowserType.FireFox); browser.OpenBrowser(); string page = string.Format("http://{0}/swat/{1}", Environment.MachineName.ToLower(), "SpanishCharactersPage.html"); browser.NavigateBrowser(page); try { string title = browser.GetWindowTitle(); Assert.AreEqual(title, actualTitle); } finally { browser.CloseBrowser(); } }
public void TestPressKeysInSixtyFourBit() { browser = new WebBrowser(BrowserType.InternetExplorer); IBrowser browserObj = (IBrowser) ReflectionHelper.GetField<object>(browser, "_browser"); KeyboardInput input = new KeyboardInput(browserObj); browser.OpenBrowser(); browser.NavigateBrowser("http://www.google.com"); try { ReflectionHelper.SetField(input, "forceSixtyFourBit", true); input.ProcessKey(NativeMethods.VkKeyScan('a')); input.SendInputString(browserObj.GetCurrentWindowTitle()); } finally { // Clean up ReflectionHelper.SetField(input, "forceSixtyFourBit", false); browser.KillAllOpenBrowsers(); } }
public void ChromeClosesPortsCorrectlyAfterUseTest() { _browser = new WebBrowser(BrowserType.Chrome); _browser.OpenBrowser(); _browser.KillAllOpenBrowsers(); }
public void CloseBrowsersBeforeTestStartTest() { // Save the value to reset it later bool reset = SWAT.WantCloseBrowsersBeforeTestStart.CloseBrowsersBeforeTestStart; string ieProcessName = "iexplore"; string ffProcessName = "firefox"; bool areAllIEClosed; bool areAllFFClosed; WebBrowser _IEBrowser = new WebBrowser(BrowserType.InternetExplorer); WebBrowser _FFBrowser = new WebBrowser(BrowserType.FireFox); SWAT.Fitnesse.SWATFixture testing; // Open multiple windows to close _IEBrowser.OpenBrowser(); _IEBrowser.NavigateBrowser("www.google.com"); _IEBrowser.OpenBrowser(); _IEBrowser.NavigateBrowser("www.w3schools.com"); // Set the user setting to false SWAT.WantCloseBrowsersBeforeTestStart.CloseBrowsersBeforeTestStart = false; SWAT.UserConfigHandler.Save(); // SWATFixture's constructor should not kill all open IE browsers testing = new InternetExplorerSWATFixture(); // Assert that all the IE browsers have not closed areAllIEClosed = (Process.GetProcessesByName("iexplore").Length == 0); Assert.IsFalse(areAllIEClosed, "CloseBrowsersBeforeTestStart failed: " + "closed all windows when the user setting was turned off."); // Open multiple windows to close again _IEBrowser.OpenBrowser(); _IEBrowser.NavigateBrowser("www.google.com"); _IEBrowser.OpenBrowser(); _IEBrowser.NavigateBrowser("www.w3schools.com"); // Set the user setting to true SWAT.WantCloseBrowsersBeforeTestStart.CloseBrowsersBeforeTestStart = true; SWAT.UserConfigHandler.Save(); // SWATFixture's constructor should kill all open IE browsers testing = new InternetExplorerSWATFixture(); // Assert that all the IE windows have been closed areAllIEClosed = (Process.GetProcessesByName(ieProcessName).Length == 0); Assert.IsTrue(areAllIEClosed, "CloseBrowsersBeforeTestStart failed: " + "did not close all windows."); // Open multiple windows to close again _IEBrowser.OpenBrowser(); _IEBrowser.NavigateBrowser("www.google.com"); _IEBrowser.OpenBrowser(); _IEBrowser.NavigateBrowser("www.w3schools.com"); // Open multiple windows to close again _FFBrowser.OpenBrowser(); _FFBrowser.NavigateBrowser("www.google.com"); _FFBrowser.OpenBrowser(); _FFBrowser.NavigateBrowser("www.w3schools.com"); // SWATFixture's constructor should kill all open IE and FF browsers testing = new FireFoxSWATFixture(); // Assert that all the IE windows have been closed areAllIEClosed = (Process.GetProcessesByName(ieProcessName).Length == 0); Assert.IsTrue(areAllIEClosed, "CloseBrowsersBeforeTestStart failed: " + "did not close all windows."); // Assert that all the FF windows have been closed areAllFFClosed = (Process.GetProcessesByName(ffProcessName).Length == 0); Assert.IsTrue(areAllFFClosed, "CloseBrowsersBeforeTestStart failed: " + "did not close all windows."); // Reset the user config setting SWAT.WantCloseBrowsersBeforeTestStart.CloseBrowsersBeforeTestStart = reset; SWAT.UserConfigHandler.Save(); }