Skip to content
Assiance edited this page Jan 24, 2012 · 14 revisions

******************************Examples **************************

ElementSe ele = new ElementSe(WebDriver, By.Id("theId"));
        

SelectListSe selectList = new SelectListSe(WebDriver, By.ClassName("theClassName"));
        
selectList.SelectListItem("theOption");

bool visible = selectList.IsVisible();
string theSelectedItem = selectList.GetSelectedItem();


TableSe aTable = new TableSe(WebDriver, By.Id("anID"));
        
// click cell 8 on row 4
aTable.TableBody.Rows[5].Cells[9].Click();

// clear the field and type Tiger in the first cell that contains Tigere in the first row that contains Cats  
aTable.TableBody.Rows.First(i => i.Text == "Cats").Cells.First(i => i.Text == "Tigere").ClearFirstSendKeys("Tiger");

// Gets The First Image in column 4 from the table where row contains "Inactive People" in column 0
aTable.TableBody.GetTableElement<ImageSe>(4, new FindRow("Inactive People", 0));

***********************WebDriver Vs WebDriverSEd ***********************************

//The same for both
WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

//Initializing******************************************************

//***webDriver
//IWebElement pageHolderdivClass = WebDriver.findElement(By.ClassName("pageHolder"));
//***WebDriverSEd
 ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));

//***webDriver
//IWebElement loanAmount_searchWholePage = WebDriver.findElement(By.Id("ctl00_well_DefaultUC_loanAmount"));
//IWebElement loanAmount_searchPageHolderDiv = pageHolderdivClass.findElement(By.Id("ctl00_well_DefaultUC_loanAmount"));
//***WebDriverSEd
ElementSe loanAmount_searchWholePage = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));

//Sending Keys******************************************************

//***WebDriver
//pageHolderdivClass.Clear();
//pageHolderdivClass.SendKeys("3000.00");
//***WebDriverSEd
pageHolderdivClass.ClearFirstSendKeys("3000.00");

// Using a SelectList***************************************************

//***webDriver
//IWebElement month = WebDriver.findElement(By.Id("ctl00_well_DefaultUC_LoanMonth"));
//***webDriverSEd
SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

//***WebDriver
//SelectElement monthSelect = new SelectElement(month);
//Assert.IsTrue(monthSelect.SelectedOption.Text == "Jan");
//***WebDriverSEd
Assert.IsTrue(month.SelectedOption.Text == "Jan");

//***WebDriver
//monthSelect.SelectListItem("Aug");
//***WebDriverSEd
month.SelectListItem("Aug");

// Using LinQ Statements**************************************************
        
//***WebDriver
//There isnt a way to do LinQ statements in the webdriver therefore you would have to use the xpath or css selectors to find this element.
//***WebDriverSEd
new ButtonSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate").Click();

}

Clone this wiki locally