Verifying the canonical tag on a web page using Selenium GetLocation

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); […]

Using Selenium in a Ajax web application

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. The Ajax application […]

Validating the text from a text box using Selenium RC

Here is the html code input id=”qu” and the text in the text input box is Selenium Wiki. To validate the text from a text box using Selenium RC you will have to use the Selenium command selenium.getValue(). This will get the value in the location input id=”qu”. selenium.getValue(“//input[@id=’qu’]”) If you found this solution helpful […]

Handling IE Security Warning in Selenium RC

When I was running the Selenium RC scripts on IE browser I was getting a Security Warning popup box. Because of this the script was not running and the tests failed. To resolve the issue I used the selenium command selenium.ChooseOkOnNextConfirmation(). This is in Visual Studio C#. In Java its selenium.chooseOkOnNextConfirmation() If you found this […]

Comparing Dates in C# , selenium RC

Example to convert string to date time variable and also compare two date time variable. string Firstdate = selenium.GetText(FirstDate_xp); string Nextdate = selenium.GetText(Nextdate_xp); DateTime date1 = Convert.ToDateTime(Firstdate); DateTime date2 = Convert.ToDateTime(Nextdate); int result = DateTime.Compare(date1, date2); //Compare function returns //0 if both dates are equal //1 if date1 is recent than date2 //-1 if date2 […]