Selenium Toolkit Configuration settings
Selenium Toolkit for .NET was designed to streamline setup and configuration of Selenium so that you could start writing tests sooner. The default configuration settings, in combination with the registry key added by the installer, has everything you need to start prototyping. Once you move out of the prototyping stage, you may want to move some settings to the configuration file.
Configuration Settings
A minimum configuration example that uses the registry to locate the Selenium libraries:
<configuration>
<configSections>
<section name="Selenium" type="SeleniumToolkit.Config.SeleniumConfiguration, SeleniumToolkit" />
</configSections>
<Selenium
BrowserUrl="http://mysite.com"
/>
</configuration>
A full configuration example:
<configuration>
<configSections>
<section name="Selenium" type="SeleniumToolkit.Config.SeleniumConfiguration, SeleniumToolkit" />
</configSections>
<Selenium
server="localhost"
port="4444"
defaultBrowser="*firefox"
BrowserUrl="http://www.codeplex.com"
factoryType="MyProject.MySeleniumFactory,MyProject"
>
<!-- NUnit Addin settings (optional) -->
<addin recylePerFixture="true" />
<!-- Selenium RC runtime settings (optional) -->
<runtime
autoStart="true"
autoStop="true"
location="c:\Program Files\SeleniumToolkit\server"
proxyServer="servername"
proxyPort="8080"
proxyUser="username"
proxyPassword="password"
/>
<!-- custom browser aliases (optional) -->
<browsers>
<add key="ff-custom"
value="*custom "C:/Program Files/Mozilla Firefox/firefox.exe" -no-remote -profile "C:\profilepath"" />
<add key="ie" value="*iexplore" />
</browsers>
<!-- custom user extensions (optional) -->
<userExtensions>
<add name="myextension" path="C:\Path\extension.js" />
<add name="other" path="C:\Path\SubFolder" />
</userExtensions>
</Selenium>
</configuration>
Selenium element
Defines the network location of the Selenium RC and common settings for the application under test.
Name | Description | Default Value | Required |
server (attribute) | Server name of the Selenium RC host | localhost | false |
port (attribute) | Port number of the Selenium RC host | 4444 | false |
defaultBrowser (attribute) | Selenium browser profile to use. | *iexplore | false |
BrowserUrl (attribute) | Base url for all selenium tests | null | true - if not supplied by WebFixture or WebTest attribute |
factoryType | Type of factory object used to create custom ISelenium instances - if not supplied, a default factory is used (added 0.81) | null | false |
addin (element) | NUnit addin settings | default | false |
runtime (element) | Configuration settings for Selenium-RC process | default | false |
browsers (element) | Custom browser aliases | default | false |
userExtensions (element) | Custom javascript extensions | null | false |
Addin element
Defines settings for the NUnit addin. If this element is not provided, the default values will be used.
Name | Description | Default Value | Required |
recyclePerFixture (attribute) | Recylcing per fixture reuses the browser for all tests, which reduces setup/teardown overhead. When false, the browser is closed after each test. | true | false |
Note: the
DefaultBrowser attribute is ignored on methods marked with the
WebTest attribute if the browser life cycle is controlled by the fixture -- if you want each test to run under different browsers, set this value the
recyclePerFixture setting to false.
Runtime element
Defines the physical environment settings for the Selenium-RC java process. If this element is not provided, the default values will be used.
Name | Description | Default Value | Required |
autostart | Flag to indicate whether the runtime should initialize a Selenium RC host. When set to false, an existing Selenium RC host must be available. | true | false |
autostop | Flag to indicate whether the runtime should terminate the Selenium RC host at the end of all tests. | true | false |
location | Folder location of the Selenium-RC java libraries. If no value is supplied, it will resolve from the Registry setting | InstallDir\server | false |
proxyServer | Server name of the proxy-server to route Selenium-RC traffic through. (added in 0.81) | null | false |
proxyPort | Port number of the proxy-server. (added in 0.81) | - | false |
proxyUser | Username if your proxy server requires authentication. (added in 0.81) | null | false |
proxyPassword | Password if your proxy server requires authentication. (added in 0.81) | null | false |
Browsers element
Defines aliases for browsers to support custom profiles. If this element is not provided, the default values will be used. (added in 0.81)
Name | Description | Default Value | Required |
key | Name of browser alias used by your tests. | - | true |
value | The value to pass to selenium as the browser name | - | true |
User Extensions element
Defines a set of custom user-extensions that will be loaded into the Selenium RC. Files are appended in the order that they appear in the configuration. Files and Folders are supported. (added in 0.81)
Name | Description | Default Value | Required |
name | Name of the user-extension | - | true |
path | Path to the javascript file or folder | - | true |
Registry Settings
A single registry key is added by the installer to simplify locating the selenium-server libraries. If you supply your own configuration settings, this registry key is not required.
Location | Name | Description | Default Value |
HKCU\Software\SeleniumToolkit (on 32Bit OS) | InstallDir | Root folder of the Selenium Toolkit installation folder. | value supplied by installation |
HKCU\Software\Wow6432Node\SeleniumToolkit (on 64Bit OS) | InstallDir | Root folder of the Selenium Toolkit installation folder. | value supplied by installation |