WebDriver

Using selenium.GetSelectedLabel in Webdriver 

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

public string GetSelectedLabel(string xpath)
{
string text = "";
if (driver.FindElement(By.XPath(xpath)).Selected)
{
text = GetText(xpath + "/option[@selected]");
}
return text;
}

By Pavandeep Puddupakkam on December 14, 2011 | WebDriver | 1 comment
Tags: , ,

Using selenium.GetSelectedIndex in Webdriver 

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

public string GetSelectedIndex(string xpath)
{
string text="";
int statenum = Convert.ToInt32(GetXpathCount(xpath+"/option"));
for (int i = 1; i < statenum; i++)
{
if (IsElementPresent(xpath+"/option[" + i + "][@selected]"))
{
text = Convert.ToString((i - 1));
}
}
return text;
}

Using selenium.SelectedLabel in Webdriver 

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

public string SelectedLabel(string xpath)
{
string text = "";
if (IsElementPresent(xpath))
{
text = GetValue(xpath + "/following-sibling::label");
}
return text;
}

Using selenium.Uncheck in Webdriver 

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

public void Uncheck(string xpath)
{
if (driver.FindElement(By.XPath(xpath)).Selected)
{
driver.FindElement(By.XPath(xpath)).Click();

More...

By Pavandeep Puddupakkam on | WebDriver | A comment?
Tags: , ,

Using selenium.Check in Webdriver 

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

public void Check(string xpath)
{
if (!driver.FindElement(By.XPath(xpath)).Selected)
{
driver.FindElement(By.XPath(xpath)).Click();

More...

By Pavandeep Puddupakkam on | WebDriver | A comment?
Tags: , ,

Using selenium.SelectWindow in Webdriver 

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

public void SelectWindow(string Text)
{
driver.SwitchTo().Window(Text);
}