Here is a video link this shows you how to create test list using Visual studio and how to run the tests from command prompt. This can be used to create batch jobs and schedule them with in the build or to run every night.
I am using Excel to store the test data and use Visual Studio 2010 C# to code the selenium scripts. When running the scripts I was getting the TF80070 error. I had to click on the confirmation box to continue testing. So it when from automation testing to manual testing (because of the error message).
Anyway here is the solution.
Open excel and then go to excel options. Select Add-Ins and the from the manage select list select COM Add-ins. From the COM Add-ins uncheck Team Foundation Add-in check box. This will stop the annoying error message from appearing.
Here is an example to verify the canonical tag on a web page using Selenium GetLocation. The selenium script is written in C#
public int CheckCanonicalTag()
{
int resultcount = 0;
string URL = selenium.GetLocation();
if (selenium.IsElementPresent("//link[@rel='canonical' and @href='" + System.Web.HttpUtility.UrlDecode(URL) + "']"))
{
Console.WriteLine( "Canonical tags is present on the page :" + URL);
}
else
{
Console.WriteLine( "Canonical tags is not present on the page :" + URL);
resultcount++;
}
return resultcount;
}
On an Ajax web application or Ajax feature on web page small sections of the page will update and often the entire webpage will not load. It’s necessary to wait until this ajax process is completed before interacting with sections of the page where content or controls are yet to be rendered.
Extracting information from datetime variable.
DateTime d = DateTime.Today;
d.Day -> Extracts the day
d.Month-> Extracts the month
d.Year -> Extracts the year
Split Function can be used to split strings on spaces
string s = "Splitting a string";
string[] words = s.Split(' ');
foreach (string word in words)
{
Console.WriteLine(word);
}