Skip to content

WebDriverSEd Tutorial

Assiance edited this page Apr 26, 2012 · 31 revisions

This is just a very very small taste of WebDriverSed!!!

Creating a FireFox Profile

IWebDriver WebDriver = new FirefoxDriver();

Initializing an Div and Searching By Id within the WebDriver PageSource

DivSe fooDiv = new DivSe(WebDriver, By.Id("anId"));

Initializing an CheckBox and Searching By classname within the fooDiv

CheckBoxSe chkBox = new CheckBoxSe(fooDiv, By.ClassName("name"));

Initializing an Span and Searching By classname and where text contains turtle within the fooDiv (must include WebDriverSed.Extensions namespace)

SpanSe mySpan = new SpanSe(fooDiv, By.ClassName("bar"), i => i.Text.Contains("turtle"));

Returns a list of all the Buttons inside the fooDiv

var myButtons = fooDiv.Buttons;

Returns the first Button inside the fooDiv with an Id of bar

var theButton = fooDiv.Button(i => i.Id == "bar");

Death to xpath and css contains selectors! Use LinQ to DOM instead!

Find a table with the Id of "fooTable" find a row in the table body that contains "key" in column 0.

Click the first link in the row.

var row = new TableSe(WebDriver, By.Id("fooTable")).TableBody.FindRow("key", 0);

row.Links.First().Click();