Skip to content

For all of you .net developers aggravated that the C# version of the selenium webdriver doesnt have much support or functions. This project contains specialized classes and functions that work with the webdriver to make things sooo much easier... enjoy. Many More functions to come soon. Christmas holidays slowed me down a lil. Should be on track…

tablesmit/Selenium2-WebDriverSEd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium  2.0 (WebDriver) Helper Classes ---Only For C#---

GO TO THE WIKI!!!!!!! FOR MORE DETAILED HELP

Make sure to let me know if you are having any issues with anything and I will get to fixing them as soon as I can
or if you are up to it you are welcome to give fixing it a try. Just send the files and I will get them in the repo 
as soon as possible and also make sure to give you some credit. This repo is sure to stay active. My company is 
planning on writing their tests for most of their software in selenium and I'm in the process of converting 2000+ tests. 
So I'm busy trying to make re-writing those tests as easy as possible.


Sample. You may copy and paste code

[Test]
public void Class_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----*************************
[Test]
public void 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();
}

About

For all of you .net developers aggravated that the C# version of the selenium webdriver doesnt have much support or functions. This project contains specialized classes and functions that work with the webdriver to make things sooo much easier... enjoy. Many More functions to come soon. Christmas holidays slowed me down a lil. Should be on track…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 64.5%
  • HTML 28.1%
  • XSLT 6.7%
  • Other 0.7%