This document provides an overview of Selenium, including its history and capabilities. It discusses how Selenium allows automated control and testing of browsers, using locators to find and interact with elements on web pages. Selenium supports multiple programming languages and distributed testing across a grid of machines. The document provides examples of using Selenium, including a simple test and implementing the page object model pattern to make tests more maintainable. It also mentions some related tools that can be used with Selenium for tasks like visual testing and network simulation.
2. Started @ Google
JavaScript injection
Remote Control (RC)
Merged with the WebDriver Project (current)
Performs native browser events
Mainly developed by Google and Mozilla
Selenium Short HistorySelenium History
9. WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
Simple Sample of Selenium
Yay for Alliteration!
10. CRTL + C
ALT + Tab
CTRL + V
Maintainable tests == false
Issues with the Sample
15. [Test]
public void LoginTest()
{
var page = HomePage.LoginAs(^admin ̄, ^password ̄).menu.LogOut();
Assert.True(page.Text.Contains(), ^Thank you! ̄)
}
^English ̄ Example
16. [TestCaseSource(typeof(BaseTest), "AllTestCases")]
public void ApproveCompanyTest(Browsers b, Platforms p,Resolutions r, int v)
{
var page = new HomePage(this.driver).
gotoLogin().
LoginAs("admin", "password").
GoToPublisherApprovalQueue().
ApproveCompany("gizmodo");
Assert.That(page.SearchFor("gizmodo").GetNumberOfRecords().Equals(0));
}
Actual Example