PMC:QA:selenium
Contents
Selenium Projects
Selenium has many projects that combine to make a versatile testing system.
more please review
http://seleniumhq.org/projects/
http://seleniumhq.org/docs/01_introducing_selenium.html#id1
Selenium IDE
Selenium IDE is a Firefox add-on that makes it easy to record and playback tests in Firefox 2+. You can even use it generate code to run the tests with Selenium Remote Control.
Selenium RC
Selenium Remote Control is a client/server system that allows you to control web browsers locally or on other computers, using almost any programming language and testing framework.
Selenium Grid
extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel.
Selenium RC
Selenium RC Installation
download
download Selenium RC from http://seleniumhq.org/download/ or download previous versions from http://seleniumhq.org/download/previous.html
start Selenium server
extract selenium-remote-control-xxx.zip
- start server by:
java -jar selenium-server.jar
- you'll get info as follow:
Note:For the server to run you’ll need Java installed,and java needs to be 1.5 or later
You can check that you have Java correctly installed by running the following on a console:
java -version
From Selenese to a Program(via Selenium IDE)
The primary task for using Selenium-RC is to convert your Selenese into a programming language.
Sample Test Script
Let’s start with an example Selenese test script.
Selenium IDE
* install Selenium IDE
goto download page:http://seleniumhq.org/download/
select Selenium IDE,then it will pop up a installation window,install it and restart your Firefox.
* Opening the IDE
To run the Selenium-IDE, simply select it from the Firefox Tools menu. It opens as follows with an empty script-editing window and a menu for loading, or creating new test cases.
* Imagine recording the following test with Selenium-IDE.
Selenese as Programming Code
Selenese as java Programming Code
at selenioum IDE tools,select Options -> Format -> java(Junit)
Using the Java Client Driver
Java Client Driver Configuration
In General configuration of Selenium-RC with any java IDE would have following steps:
1 Download Selenium-RC from the SeleniumHQ downloads page 2 Start any java IDE 3 Create new project 4 Add to your project classpath selenium-java-client-driver.jar 5 Record your test from Selenium-IDE and translate it to java code (Selenium IDE has automatic translation feature to generate tests in variety of languages) 6 Run selenium server from console 7 Run your test in the IDE
here i configurate Selenium-RC With Eclipse.
Configuring Selenium-RC With Eclipse:please refer to http://seleniumhq.org/docs/appendix_installing_java_driver_client.html#configuring-selenium-rc-eclipse-reference
Run selenium server from console
Run test case in the Eclipse IDE:
- the info from console
- and the open window
Problems:
maybe you should get problems in selenium server console:
15:44:58.067 WARN - Caution: '/usr/bin/firefox': file is a script file, not a real executable. The browser environment is no longer fully under RC control
solution:
please refer to:
- http://stackoverflow.com/questions/1713981/selenium-not-working-with-firefox-3-x-on-linux
- http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium
Selenium rc Interactive Mode
start Selenium Server
* start Selenium rc server with:
java -jar selenium-server.jar -interactive
then you will get information as follow:
test Interactive Mode
now let's run some commands to view Selenium rc Interactive Mode
- try the first command
cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com
- command 2
open page http://google.com
cmd=open&1=http://www.google.com/webhp&sessionId=606401
- command 3
cmd=type&1=q&2=selenium rc&sessionId=606401
- command 4
cmd=click&1=btnG&sessionId=606401
References
- Selenium-IDE: http://seleniumhq.org/docs/03_selenium_ide.html
- Selenium-RC: http://seleniumhq.org/docs/05_selenium_rc.html
- Selenium-RC FAQ:http://wiki.openqa.org/display/SRC/Selenium+RC+FAQ
Links
- Go back to PMC:QA