{"_id":"54c521751613c70d00eeacc5","user":"54c4b05742190d0d00f5fbde","githubsync":"","project":"54c51c5e2418480d0028a2c0","__v":0,"category":{"_id":"54c51dbd1613c70d00eeacbe","pages":["54c521751613c70d00eeacc5","54ce0070584df10d00fe6998","54ce0c77fcc16f0d00f783fd"],"project":"54c51c5e2418480d0028a2c0","__v":3,"version":"54c51c5e2418480d0028a2c3","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-01-25T16:45:49.425Z","from_sync":false,"order":1,"slug":"configuration","title":"Configuration"},"version":{"_id":"54c51c5e2418480d0028a2c3","__v":4,"project":"54c51c5e2418480d0028a2c0","createdAt":"2015-01-25T16:39:58.382Z","releaseDate":"2015-01-25T16:39:58.382Z","categories":["54c51c5e2418480d0028a2c4","54c51da3796aed0d009fc80f","54c51db22418480d0028a2c9","54c51dbd1613c70d00eeacbe"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-01-25T17:01:41.482Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"The simplest possible configuration to start using Seleno is just one line. If you are using an ASP.NET web application within the same solution as your test project then all Seleno needs to know is the name of the web project to test and the port number to run it on. SelenoHost is your portal to Seleno and you will need an instance of the class in order to talk to Seleno. This class takes care of a lot of things and is a relatively expensive class to \"run\" once per test. So you would normally create one instance and use it in all your tests. \n\n public static class Host\n {\n public static readonly SelenoHost Instance = new SelenoHost();\n\n static Host()\n {\n Instance.Run(\"TestStack.Seleno.Samples.Movies\", 19456);\n }\n }\n\nThis will deploy your web application with IIS Express and open up FireFox to run your tests. When the application domain unloads it will unload the browser and web server.\n\nBy default, Seleno uses:\n\n- FireFox for the web browser\n- IIS Express for the web server\n- No logger\n- No camera for taking screenshots\n\nIf you want to change these defaults, you can use a fluent configuration to override them. For example, if you wanted to use Chrome instead of Firefox (the default) and to log messages to the console, you could write:\n\n Instance.Run(\"TestStack.Seleno.Samples.Movies\", 19456,\n\t configure => configure\n\t\t .WithRemoteWebDriver(BrowserFactory.Chrome)\n\t\t .UsingLoggerFactory(new ConsoleFactory())\n );\n\n> Note: To use the Chrome WebDriver you also need to download [ChromeDriver.exe](https://code.google.com/p/selenium/wiki/ChromeDriver) and make sure it is in your bin directory when you run your tests. Once you install the NuGet package you can also type `Install-ChromeDriver` into the NuGet package manager console and this will install the driver for you.\n\n\n\nThere are more things that you can configure too. The original use case for Seleno was to test Visual Studio web projects for ASP.Net and ASP.Net MVC and it defaults to doing this with IIS Express. Seleno attempts to be modular and easy to customise though, so to test any website instead is just a matter of swapping out the IisExpressWebServer for the InternetWebServer. For example, to test Google UK:\n\n Instance.Run(configure => configure\n \t.WithWebServer(new InternetWebServer(\"www.google.co.uk\")));","excerpt":"","slug":"basic-configuration","type":"basic","title":"Basic Configuration"}

Configuration

Page Objects

Basic Configuration

The simplest possible configuration to start using Seleno is just one line. If you are using an ASP.NET web application within the same solution as your test project then all Seleno needs to know is the name of the web project to test and the port number to run it on. SelenoHost is your portal to Seleno and you will need an instance of the class in order to talk to Seleno. This class takes care of a lot of things and is a relatively expensive class to "run" once per test. So you would normally create one instance and use it in all your tests.
public static class Host
{
public static readonly SelenoHost Instance = new SelenoHost();
static Host()
{
Instance.Run("TestStack.Seleno.Samples.Movies", 19456);
}
}
This will deploy your web application with IIS Express and open up FireFox to run your tests. When the application domain unloads it will unload the browser and web server.
By default, Seleno uses:
- FireFox for the web browser
- IIS Express for the web server
- No logger
- No camera for taking screenshots
If you want to change these defaults, you can use a fluent configuration to override them. For example, if you wanted to use Chrome instead of Firefox (the default) and to log messages to the console, you could write:
Instance.Run("TestStack.Seleno.Samples.Movies", 19456,
configure => configure
.WithRemoteWebDriver(BrowserFactory.Chrome)
.UsingLoggerFactory(new ConsoleFactory())
);
> Note: To use the Chrome WebDriver you also need to download [ChromeDriver.exe](https://code.google.com/p/selenium/wiki/ChromeDriver) and make sure it is in your bin directory when you run your tests. Once you install the NuGet package you can also type `Install-ChromeDriver` into the NuGet package manager console and this will install the driver for you.
There are more things that you can configure too. The original use case for Seleno was to test Visual Studio web projects for ASP.Net and ASP.Net MVC and it defaults to doing this with IIS Express. Seleno attempts to be modular and easy to customise though, so to test any website instead is just a matter of swapping out the IisExpressWebServer for the InternetWebServer. For example, to test Google UK:
Instance.Run(configure => configure
.WithWebServer(new InternetWebServer("www.google.co.uk")));