ZloiAdun, OpenQA.Selenium.Support.UI Select. , api . , -, .
<!DOCTYPE html>
<head>
<title>Disposable Page</title>
</head>
<body >
<select id="select">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</body>
</html>
, . , Select, IWebElement. Select . , .
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium;
using System.Collections.Generic;
using OpenQA.Selenium.IE;
namespace Selenium2
{
class SelectExample
{
public static void Main(string[] args)
{
IWebDriver driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("www.example.com");
Select select = new Select(driver.FindElement(By.Id("select")));
IList<IWebElement> options = select.GetOptions();
foreach (IWebElement option in options)
{
System.Console.WriteLine(option.Text);
}
select.SelectByValue("audi");
System.Console.ReadLine();
driver.Quit();
}
}
}
, . -, DLL . Java ( PageObject), .Net. , . SVN, WebDriver.Common.dll - # Express 2008. , Internet Explorer Firefox.
, . , , select
driver.FindElements(By.TagName("select"));
all. , , driver.FindElement, 's'.
, Inavigation . , driver.Navigate().GoToUrl("http://example.com");
, DefaultSelenium - Selenium 1.x apis. Selenium 2 - Selenium 1, , Selenium 2 api ( WebDriver api), DefaultSelenium.