Step1:
Selenium IDE
- Install selenium IDE as add on in your firefox browser.
- Run Selenium IDE and record script using it with language as C#.
- Stop recording and copy the code.
Step2:
Selenium RC
- Download selenium RC file and extract it to your local folder
- Go through command prompt and local folder directory
- Write command as java – version to check java environment availability.
- If java environment is not there then install it first using jdk 1.6
- Write command as java –jar selenium-server.java
- It will start selenium RC server. If it gives port error then write java –jar selenium-server.jar –port 5555
Step3:
Visual Studio 2008
- Create one project with window application
- Add references with client drivers of selenium in the project
- In form1 add one button
- In project add one class as new item.
- Copy your selenium IDE c# script to that class1.cs
- In setup method give URL of your site going to be test in class1.cs as
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.gmail.com/");
selenium.Start();
verificationErrors = new StringBuilder();
}
7. Add reference of using library
8. In form1.cs button’s click event make object of that class using
private void button1_Click(object sender, EventArgs e)
{
SeleniumTests.Untitled a = new Untitled();
a.SetupTest();
a.TheUntitledTest();
a.TeardownTest();
}
9. Build the solution and run the application on click of button.
No comments:
Post a Comment