In Selenium IDE you could simply use getSelectedLabel | locator and that was your currently selected item in the drop down list. Its a bit more of a roundabout way with WedDriver as you can see from the method I have written below:
[code]
using OpenQA.Selenium;
using OpenQA.Selenium.Support.PageObjects;

// …

public string getSelectedLabel(ddlDropListID)
{
string selected;
SelectElement selectOption = new SelectElement(ddlDropListID);
selected = selectOption.SelectedOption.Text;
return selected;
}
[/code]

View Details

In WebDriver there is no direct replacement of the Selenium IDE command selectFrame, however there is a fairly straightforward approximation by using the driver.SwitchTo() method. This method allows you to change the focus to different windows, alerts and frames, but we will be focussing on frames in this post. Below are examples on how to switch to a frame by using its ID, its parent frame, or the top level.

To select the frame by specifying its ID, replace [code] selectFrame | frmFrameID | [/code]
With:
[code]
IWebElement frmDashboard = null;
frmDashboard = driver.FindElement(By.Id(“frmDashboard”));
driver.SwitchTo().Frame(frmDashboard);
[/code]

To select the top level frame, replace [code] selectFrame | relative=top | [/code] with the following line
[code] driver.SwitchTo().DefaultContent();[/code]

And finally to select a frame by the current frame’s parent frame, replace [code]selectFrame | relative=up | [/code] with the following line
[code] driver.SwitchTo().ParentFrame();[/code]

View Details