1. Create a new solution by choosing class library
2. Download the Selenium references for c # from http://www.seleniumhq.org/download/
3. Download Gallio refernces from http://code.google.com/p/mb-unit/downloads/list select GallioBundle-3.4.14.0-Setup-x86.msi 4. Provide the following referneces for the class.cs
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Firefox;
using Gallio;
using Gallio.Framework;
using MbUnit.Framework;
5. Copy below .cs file and make necessary changes
/*
* Created by SharpDevelop.
* User: Admin
* Date: 3/3/2015
* Time: 3:29 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Configuration;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Firefox;
using Gallio;
using Gallio.Framework;
using MbUnit.Framework;
namespace Configurationfiles
{
/// <summary>
/// Description of MyClass.
/// </summary>
[TestFixture]
public class MyClass
{
public IWebDriver _driver = null;
[SetUpAttribute]
public void setup()
{
_driver = new FirefoxDriver();
}
[TearDown]
public void teardown()
{
_driver.Quit();
}
[Test]
public void method()
{
string url = ConfigurationManager.AppSettings["value1"];
_driver.Navigate().GoToUrl(url);
IWebElement query = _driver.FindElement(By.Name("q"));
// Enter something to search for
query.SendKeys("Selenium");
// Now submit the form
query.Submit();
// Google's search is rendered dynamically with JavaScript.
// Wait for the page to load, timeout after 5 seconds
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(5));
wait.Until((d) => { return d.Title.StartsWith("selenium"); });
//Check that the Title is what we are expecting
Assert.AreEqual("selenium - Google Search", _driver.Title);
}
}
}
6. Add a configuration file and add a key and value as <add key="value1" value="https://www.google.co.in/?gws_rd=ssl"/>
7. Build the solution
8. Load the application dll in GallioIcarus.exe
9. Run the test
Version of the product using:
SharpDevelop Version : 4.4.1.9729-7196a277
.NET Version : 4.0.30319.34209
Gallio : Version 3.4 build 11
Selenium : 2.45.0
OS : Windows 7
Firefox : 36
Additional information below.
Screenshot: http://screencast.com/t/3NGgSapXZ
↧
Unable to get valued from config files null exception is displayed - Can't load file RemoteWebDriver.cs under c:\Projects\webdriver\dotnet\src\webdriver\Remote. Check the file permission and the existence of that file.
↧