Selenium RC

Using selenium.GetAttribute in Webdriver 

Here is the Selenium RC code for selenium.GetAttribute in Webdriver. This code is in Visual Studio C#

public string GetAttribute(string xpath, string attribut)
{
string value = "";
if (IsElementPresent(xpath))
{
value = driver.FindElement(By.XPath(xpath)).GetAttribute(attribut);
}
return value;
}

By Pavandeep Puddupakkam on December 9, 2011 | Selenium RC, WebDriver | A comment?
Tags: , ,

Using selenium.Select in Webdriver 

Here is the Selenium RC code for selenium.Select in Webdriver. This code is in Visual Studio C#

public void Select(string xpath, string value)
{
driver.FindElement(By.XPath(xpath+"/option[.='"+value+"']")).Click();
}

Using selenium.Open in Webdriver 

Here is the Selenium RC code for selenium.Open in Webdriver. This code is in Visual Studio C#

public void Open(string URL)
{
driver.Navigate().GoToUrl(URL);
}

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);
}
else
{
Console.WriteLine( "Canonical tags is not present on the page :" + URL);
resultcount++;
}
return resultcount;
}

More…

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.

More…

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']“)

More…

By Pavandeep Puddupakkam on September 8, 2011 | Selenium RC, XPath | 2 comments
Tags: , ,