Example #1
0
        public void CanSetPathToSeleniumStandaloneJar()
        {
            var driver = new WebDriver();
            Assert.That(driver.SeleniumServerJar, Is.EqualTo("selenium-server-standalone.jar")); // default

            driver.SeleniumServerJar = "foo.jar";
            Assert.That(driver.SeleniumServerJar, Is.EqualTo("foo.jar")); // default
        }
Example #2
0
        public void CanSetHtmlUnitWhichMustRunViaRemote()
        {
            var driver = new WebDriver();
            Assert.Null(driver.Remote);
            Assert.That(driver.Browser, Is.EqualTo(WebDriver.DefaultBrowser));

            driver.Browser = "HtmlUnit";
            Assert.That(driver.Browser, Is.EqualTo("htmlunit"));
            Assert.NotNull(driver.Remote);
            Assert.That(driver.Remote, Is.EqualTo("http://localhost:" + driver.SeleniumServerPort.ToString() + "/wd/hub"));
        }
Example #3
0
        public void CanSetBrowser()
        {
            var driver = new WebDriver();
            Assert.That( driver.Browser, Is.EqualTo("firefox") );

            driver.Browser = "ie";
            Assert.That( driver.Browser, Is.EqualTo("ie") );

            driver.Browser = "arbitrary";
            Assert.That( driver.Browser, Is.EqualTo("arbitrary") );

            driver.Browser = null;
            Assert.That( driver.Browser, Is.EqualTo("firefox") ); // default if null
        }
Example #4
0
        public void Example_RemoteFirefoxViaEnvironmentVariables()
        {
            Environment.SetEnvironmentVariable("BROWSER", "FireFox");
            Environment.SetEnvironmentVariable("REMOTE",  "true"); // shortcut for telling it to boot the local selenium server

            var driver = new WebDriver();
            Assert.That(driver.Browser, Is.EqualTo("firefox"));
            Assert.That(driver.Remote,  Is.EqualTo(string.Format("http://localhost:{0}/wd/hub", driver.SeleniumServerPort)));
            Assert.That(driver.RunSeleniumStandalone, Is.EqualTo(true));
        }
Example #5
0
        public void Example_RemoteHtmlUnitViaEnvironmentVariables()
        {
            Environment.SetEnvironmentVariable("BROWSER", "HtmlUnit");
            Environment.SetEnvironmentVariable("REMOTE",  "http://some-remote-server.com:1234/foo/bar");

            var driver = new WebDriver();
            Assert.That(driver.Browser, Is.EqualTo("htmlunit"));
            Assert.That(driver.Remote,  Is.EqualTo("http://some-remote-server.com:1234/foo/bar"));
            Assert.That(driver.RunSeleniumStandalone, Is.EqualTo(false));
        }
Example #6
0
        public void Example_LocalFirefoxViaEnvironmentVariables()
        {
            Environment.SetEnvironmentVariable("BROWSER", "FireFox");

            var driver = new WebDriver();
            Assert.That(driver.Browser, Is.EqualTo("firefox"));
            Assert.Null(driver.Remote);
        }
Example #7
0
        public void Example_LocalHtmlUnitViaEnvironmentVariables()
        {
            Environment.SetEnvironmentVariable("BROWSER", "HtmlUnit");

            var driver = new WebDriver();
            Assert.That(driver.Browser, Is.EqualTo("htmlunit"));
            Assert.That(driver.Remote,  Is.EqualTo(string.Format("http://localhost:{0}/wd/hub", driver.SeleniumServerPort)));
            Assert.That(driver.RunSeleniumStandalone, Is.EqualTo(true));
        }
Example #8
0
        public void EnvironmentVariableCanBeUsedToSpecifyHtmlUnit()
        {
            Environment.SetEnvironmentVariable("BROWSER", "HtmlUnit");
            var driver = new WebDriver();
            Assert.That(driver.Remote, Is.EqualTo("http://localhost:" + driver.SeleniumServerPort.ToString() + "/wd/hub"));
            Assert.That(driver.Browser, Is.EqualTo("htmlunit"));

            Environment.SetEnvironmentVariable("BROWSER", null);
            driver = new WebDriver();
            Assert.That(driver.Browser, Is.EqualTo(WebDriver.DefaultBrowser));
            Assert.Null(driver.Remote);
        }
Example #9
0
 public void EnvironmentVariableCanBeUsedToSpecifyHtmlUnitAndRemote()
 {
     Environment.SetEnvironmentVariable("HTMLUNIT", "http://remote-server:1234/wd/hub");
     var driver = new WebDriver();
     Assert.That(driver.Remote, Is.EqualTo("http://remote-server:1234/wd/hub"));
     Assert.That(driver.Browser, Is.EqualTo("htmlunit"));
 }
Example #10
0
 public void BrowserDefaultsToFirefox()
 {
     var driver = new WebDriver();
     Assert.That( driver.Browser, Is.EqualTo("firefox") );
 }
Example #11
0
        public void CanSetWhetherOrNotSeleniumStandaloneShouldBeRun()
        {
            // by default, RunSeleniumStandalone should == null
            var driver = new WebDriver();
            Assert.Null(driver.RunSeleniumStandalone);

            // if Remote gets set to localhost and this is not set to false, it gets set to true
            driver = new WebDriver();
            Assert.Null(driver.RunSeleniumStandalone);
            driver.Remote = string.Format("http://localhost:{0}/wd/hub", driver.SeleniumServerPort);
            Assert.That(driver.RunSeleniumStandalone, Is.EqualTo(true));

            // can set to false
            driver.RunSeleniumStandalone = false;
            Assert.That(driver.RunSeleniumStandalone, Is.EqualTo(false));

            // if false, setting Remote won't override this and set it to true
            driver.Remote = string.Format("http://localhost:{0}/wd/hub", driver.SeleniumServerPort);
            Assert.That(driver.RunSeleniumStandalone, Is.EqualTo(false));
        }
Example #12
0
        public void CanSetRemoteUrlUsedForRunningAgainstSeleniumStandalone()
        {
            var driver = new WebDriver();
            Assert.Null(driver.Remote);

            driver.Remote = "http://localhost:4444/wd/hub";
            Assert.That(driver.Remote, Is.EqualTo("http://localhost:4444/wd/hub"));
        }
Example #13
0
 public Element(IWebElement nativeElement, WebDriver webDriver)
 {
     NativeElement = nativeElement;
     ParentDriver  = webDriver;
 }
Example #14
0
 public static List<IElement> List(ReadOnlyCollection<IWebElement> nativeElements, WebDriver webDriver)
 {
     var list = new List<IElement>();
     foreach (var webElement in nativeElements)
         list.Add(new Element(webElement, webDriver));
     return list;
 }