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)

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