Using Selenium 2's IWebDriver to interact with elements on the page

Posted by Andreas Grech on Stack Overflow See other posts from Stack Overflow or by Andreas Grech
Published on 2011-01-11T12:12:15Z Indexed on 2011/01/11 13:53 UTC
Read the original article Hit count: 155

Filed under:
|
|

I'm using Selenium's IWebDriver to write Unit Tests in C#.

Such is an example:

IWebDriver defaultDriver = new InternetExplorerDriver();
var ddl = driver.FindElements(By.TagName("select"));

The last line retrieves the select HTML element wrapped in a IWebElement.

I need a way to simulate selection to a specific option in that select list but I can't figure out how to do it.


Upon some research, I found examples where people are using the ISelenium DefaultSelenium class to accomplish the following, but I am not making use of this class because I'm doing everything with IWebDriver and INavigation (from defaultDriver.Navigate()).

I also noticed that ISelenium DefaultSelenium contains a ton of other methods that aren't available in the concrete implementations of IWebDriver.

So is there any way I can use IWebDriver and INavigation in conjunction with ISelenium DefaultSelenium ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about unit-testing