This is a solution for the Selenium Webdriver Type command not working on IE when you are trying to enter some text in a rich text editor. You can use the below code to execute the command in IE and other browsers.
((JavascriptExecutor)driver).executeScript("document.getElementById('ElementID').value='TextValue'");
The rich text editor is usually placed in a iFrame.
String chromeProfile =
ArrayList
switches.add("--user-data-dir=" + chromeProfile);
capabilities.setCapability("chrome.switches", switches);
driver = new ChromeDriver(capabilities);
Here is the Selenium RC code for selenium.Close in Webdriver. This code is in Visual Studio C#
public void Close()
{
driver.Close();
}
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;
}
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;
}
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;
}