public bool TestRemoteHub(string url) { string result = "OK"; bool isOk = true; try { WebSpyBrowser.TestRemoteHub(url); } catch (Exception e) { isOk = false; result = "FAILED: " + e.Message; } view.SetTestResult(result, isOk); return(isOk); }
public void Initialize_should_be_able_to_start_new_browser() { Profile browserProfile = new Profile(); browserProfile.ProfileConfig.activation.browserName = WebDriverOptions.browser_HtmlUnitWithJavaScript; WebDriverOptions options = new WebDriverOptions() { BrowserProfile = browserProfile, IsRemote = true, RemoteUrl = "http://localhost:4444/wd/hub/", }; bool isSeleniumServerAvailable = true; try { WebSpyBrowser.TestRemoteHub(options.RemoteUrl); } catch (Exception e) { isSeleniumServerAvailable = false; Console.WriteLine("FAILED: " + e.Message); } if (!isSeleniumServerAvailable) { WebSpyBrowser.RunStandaloneServer("start_selenium_server.bat"); } WebSpyBrowser.Initialize(options); var rempteDriver = (RemoteWebDriver)WebSpyBrowser.GetDriver(); rempteDriver.Capabilities.BrowserName.Should().Be("htmlunit"); WebSpyBrowser.CloseDriver(); }