Selenium Tutorial Day 73 - Selenium RC Overview

12

Click here to load reader

Transcript of Selenium Tutorial Day 73 - Selenium RC Overview

Page 1: Selenium Tutorial Day 73 - Selenium RC Overview

SeleniumWeb Test Tool Training

Discover the automating power of Selenium

Portnov Computer School presents:

Presented by: Kangeyan Passoubady (Kangs)

Copy Right: 2009-2011, All rights reserved by Kangeyan Passoubady (Kangs). Republishing requires author’s permission

Page 2: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 2

Day

Selenium RC Overview

7

Page 3: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 3

Selenium Overview

•Selenium consists of–Selenium IDE –Selenium Core–Selenium RC–Selenium Ruby on Rails –Selenium Grid

Page 4: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 4

Selenium RC #1• Selenium Remote Control (RC) is a test

tool that allows testers to write automated Web Application User Interface tests in many programming languages against any HTTP website using any mainstream JavaScript-enabled browser.

• Selenium RC comes in two parts. – A server which automatically launches

and kills browsers, and acts as a HTTP proxy for web requests from them.

– Client libraries for computer languages.

Page 5: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 5

Selenium RC Architecture

Selenium RC Server

Your Test Suiteswritten in any

supported programming

language

Point to any supported browser

Page 6: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 6

Platforms Supported by Selenium RC• Browsers

– Firefox, IE, Safari and Opera• Operating Systems

– Windows, OS X, Linux, and Solaris• Programming Languages

– C#, Java, Perl, PHP, Python, and Ruby• Testing Frameworks

– Bromine, JUnit & TenstNG (Java), NUnit (.Net), RSpec & Test::Unit (Ruby), unittest (Python)

Page 7: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 7

Selenium RC #2• The Selenium RC Server is used for testing complex

AJAX-based web user interfaces under a Continuous Integration system.

• Selenium RC is used with Selenium Core/Selenium IDE to write tests in programming languages other than the Selenese HTML table format.

• The RC server is bundled with Selenium Core and automatically loads it into the browser.

• Without using special modes, using Selenium RC test script, one cannot test domain changing web applications or within the same domain to change from insecure (http) page to secure (https) page.

Page 8: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 8

RC Command Line OptionsUsage: java -jar selenium-server.jar [-interactive] [-options] • port <nnnn>:(default 4444)

– the port number the selenium server should use• timeout <nnnn>: (eg: 180)

– an integer number of seconds• interactive:

– Interactively enter the commands.• multiWindow:

– Tests are executed in a separate window and supports web pages with frames.

• forcedBrowserMode <browser>: (eg: *iehta)– sets the forced default browser mode (e.g. "*iexplore“) for all

sessions, no matter what is passed in getNewBrowserSession

Page 9: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 9

RC Command Line Options• userExtensions <file>:

– indicates a JavaScript file that will be loaded into selenium • browserSessionReuse:

– stops re-initialization and spawning of the browser between tests

• avoidProxy: – Uses by default proxy for browser request– set this flag to make the browser use proxy only for URLs

containing '/selenium-server' • firefoxProfileTemplate <dir>:

– By default generates a fresh empty Firefox profile for every test.

– Provide a directory to use your profile directory instead.

Page 10: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 10

RC Command Line Options• debug:

– Debug mode provides more trace information and used for diagnostics purpose

• log: – When enabled writes debug information out to a log file

• htmlSuite <browser> <startURL> <suiteFile> <resultFile>: – Provide browser and URL to run a single HTML Selenese

Test suite and then exit immediately. – Provide absolute path to the HTML test suite, and HTML

results file.• proxyInjectionMode:

– A proxy injection mode is a mode where the selenium server acts as a proxy server for all content going to the AUT. Under this mode, multiple domains can be visited.

Page 11: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 11

RC Command Line Options• The following additional flags are supported for proxy injection

mode : – dontInjectRegex <regex>: an optional regular expression

that proxy injection mode can use to know when to bypass injection

– userJsInjection <file>: specifies a JavaScript file which will then be injected into all pages

• userContentTransformation <regex> <replacement>: – A regular expression which is matched against all test HTML content;

the second is a string which will replace matches. These flags can be used any number of times. A simple example of how this could be useful: if you add "-userContentTransformation https http" then all "https" strings in the HTML of the test application will be changed to be "http".

Page 12: Selenium Tutorial Day 73 - Selenium RC Overview

Discover the automating power of SeleniumCopyright © 2009-2011 by Kangeyan Passoubady (Kangs) 12

RC Command Line Options• Java system properties:

– Dhttp.proxyHost and -Dhttp.proxyPort• Normally Selenium RC overrides the proxy server configuration, using the

Selenium Server as a proxy. Use these options if you need to use your own proxy together with the Selenium Server proxy.

• Use the proxy settings like this:– java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=1234 -jar

selenium-server.jar – HTTP proxy requires authentication, you will also need to set -

Dhttp.proxyUser and -Dhttp.proxyPassword, in addition to http.proxyHost and http.proxyPort.

– java -Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=1234 -Dhttp.proxyUser=joe -Dhttp.proxyPassword=example -jar selenium-server.jar