Selenium Test Suite

Date: 2016-Dec-15
Presentation by: Anton Kireev
Meetup: Selenium Test Suite
Video: TBA

Alicante Tech Meetup

Selenium
Web Browser Automation

Anton Kireev
a.g.kireev@gmail.com

Selenium
www.seleniumhq.org

Selenium.
I. Introduction.
II. Selenium WebDriver.
III. Why / when should I use it?
IV. Speed it up!
V. Test case.

What is Selenium?
— a suite of tools for automating web browsers,
primarily used for testing purposes.

Brief history.

?

Brief history.
2004. Selenium Remote Control (RC).
( http )

Selenium
RC
Server
(proxy)

Brief history.
2006. Selenium IDE Firefox add-on (Shinya Kasatani).

Brief history.
2008. Selenium Grid.
Selenium
Server
HUB

Selenium
Server
Node 1
(Win 7)
Selenium
Server
Node 2
(Win 10)
Selenium
Server
Node 3
(Ubuntu)

Brief history.
2009. WebDriver (IE: COM, Opera: Opera Debug, Firefox: extension).

Chrome
Driver

( RDP )

Brief history.
2011. Selenium 2.0 (WebDriver).
2012. W3C WebDriver draft release (www.w3.org).
2016. Selenium 3.0 (deep revision, RC removal).

Selenium family.
● Selenium RC

● Selenium WebDriver

(Remote Control, JavaScript injection)

(special drivers for each browser)

● Selenium 1.0

● Selenium 2.0

● Selenium IDE

● Selenium Grid 2.0

(Integrated Development Environment)

(bundled with Selenium Server, WebDriver support)

● Selenium Server

● Selenium 3.0

● Selenium Grid 1.0
(RC only)

Environment.
OSs:
Windows (7+), Apple OS X, Linux (Ubuntu tested).

Programming languages:
C#, Haskell, Java, JavaScript, Objective-C, Perl, PHP, Python, R, Ruby.

Browsers:
Chrome 26+, Firefox 17+, IE 7+, Opera 11+ (Presto, Blink), Safari 5.1+.

Selenium WebDriver.
WebDriver, W3C standard.

Chrome
driver

Firefox
driver

Safari
driver

IE
driver

Opera
driver

// Create a new instance of the Firefox driver and open Google webpage
WebDriver driver = new FirefoxDriver();
driver.get(“http://www.google.com”);
// Find the text input element by its name, enter some text and submit the form
WebElement element = driver.findElement(By.name(“q”));
element.sendKeys(“Cheese!”);
element.submit();
// Wait for the page to load
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith(“cheese!”);
}
});
System.out.println(“Page title is: ” + driver.getTitle());
// Close the browser
driver.quit();

What can I do with it?

What can I do with it?
● Manage browser (open/close, profiles);
● navigate (url, history);
● work with windows, tabs, popups;
● query DOM (XPath, CSS selector, by ID);
● make inputs (keyboard, mouse);
● exec JavaScript;
● make screenshots.

Selenium limitations.
● Dialog boxes (file download);
● Flash elements;
● Java applets.

Who uses it?
Google, Microsoft, IBM, Mozilla, LinkedIn.

When should I use Selenium?
● Parsing of dynamic websites (lots of JavaScript);
● close to a user experience;
● specific automation;
● rendering matters (graphics);
● .. catching yourself doing a new browser.

Why exactly the Selenium?
● Few alternatives: watir.com, sahipro.com, watin.org;
● open source;
● support: OS, languages, browsers;
● setting the standards (W3C, 2017);
● evolving (Selenium 4 roadmap);
● integration (Jenkins, Visual Studio);
● Selenium Grid;
● docs and examples.

My use case.

Incapsula.com / 2015

Speed it up!
Selenium Grid.
I need an IE on a Win10.
Selenium
Server
HUB

Selenium
Server
Node 2
(Win 10)

Speed it up!
● WebKit: Apple Safari, Chrome (<28/iOS), PhantomJS;
● Gecko: Firefox, SlimerJS (headless via xvfb);
● Rhino: HTMLUnit.

Speed it up!
Cloud services: saucelabs.com, browserstack.com,
bugbuster.com, testingbot.com
Wrappers: selenide.org, watir.com

Conclusion
● WebDriver is almost a standard;
● support from browsers’ manufacturers;
● Selenium — power and capabilities, free;
● JavaScript is on the rise, so is the Selenium.

Test case.
Win 8

Selenium
Server
HUB

Win XP

Selenium
Server
Node
(Win XP)

Jeroen Derks

Author: Jeroen Derks

Jeroen is the founder of the Alicante Tech meetup group. His current day job is to mostly build all kinds of applications, ranging from IoT to educational to corporate.

Leave a Reply