/  75
 
Selenium Simplified
A tutorial guide to using the Selenium API in Java with JUnitAlan Richardson
Published by Compendium Developments
 
Copyright © 2010 by Alan RichardsonThe right of Alan Richardson to be identified as the author of this work has been asserted by himin accordance with the Copyright, Design and Patents Act 1988.The views expressed in this book are those of the author.First published in Great Britain in 2010 by:Compendium Developmentshttp://www.compendiumdev.co.uk/seleniumcontact details:alan@compendiumdev.co.ukAuthor's Software Testing Blog:
Compendium Developments: 
Every effort has been made to ensure that the information contained in this book is accurate at thetime of going to press, and the publishers and author cannot accept any responsibility for anyerrors or omissions, however caused. No responsibility for loss or damage occasioned by anyperson acting, or refraining from action, as a result of the material in this publication can beaccepted by the editor, the publisher or the author.Apart from any fair dealing for the purposes of research or private study, or criticism or review, aspermitted under the Copyright, Design and Patents Act 1988; this publication may only bereproduced, stored or transmitted, in any form or by any means, with the prior permission of thepublishers, or in the case of reprographic reproduction in accordance with the terms and licensesissued by the Copyright Licensing Agency, 90 Tottenham Court Road, London, W1T 4LP. Enquiriesconcerning reproduction outside these terms should be sent to the publishers.Version @ 19/01/2011 2
nd
Printinge-book ISBN : 978-0-9567332-0-7paperback book ISBN : 978-0-9567332-1-4
 
Table of Contents
Introduction..........................................................................................................................................9Getting the Source-code...................................................................................................................9Windows, Linux or Mac................................................................................................................10Acknowledgments.........................................................................................................................10Chapter 1:Getting Started With The Tools..........................................................................................11What Tools?...................................................................................................................................11Selenium IDE............................................................................................................................11Java............................................................................................................................................11Eclipse.......................................................................................................................................12Selenium-RC.............................................................................................................................12Chapter 2:Selenium IDE Basics.........................................................................................................13Install Firefox.................................................................................................................................13Install Selenium-IDE.....................................................................................................................13Capture Play Back – Recording a Script with the IDE..................................................................14Command, Target and Value..........................................................................................................17Save The Test.................................................................................................................................17Further reading...............................................................................................................................17Chapter 3:Install Java.........................................................................................................................19Chapter 4:Install and Run Selenium-RC............................................................................................20Step One - Download & Install Selenium-RC...............................................................................20Overview of the Contents of the Selenium Archive.................................................................21Step Two - Run Selenium-RC........................................................................................................22Step Three – Stop the Selenium Server.........................................................................................23From the command line............................................................................................................23From a browser URL................................................................................................................24Running an IDE Generated Test in Different Browsers................................................................24End Notes..................................................................................................................................26Chapter 5:The Eclipse IDE.................................................................................................................27First - Install Eclipse......................................................................................................................27Second - Run Eclipse.....................................................................................................................28Third - create a new Java project...................................................................................................31Chapter 6:Create a JUnit test Using the JUnit export from Selenium-IDE........................................33Introduction....................................................................................................................................33Export an IDE script as a JUnit test...............................................................................................33Load an existing script into the IDE.........................................................................................33Change the format of the script to Java.....................................................................................34Create a New Class in Eclipse..................................................................................................35Copy & Paste the code from Selenium IDE into Eclipse.........................................................38Resolve Import Errors...............................................................................................................40Add JUnit to the build path.......................................................................................................42Remove the unused import.......................................................................................................44Run the JUnit test...........................................................................................................................45Allow it through the Firewall....................................................................................................45Seeing the test running..............................................................................................................46Check the results.......................................................................................................................47It went too quickly!........................................................................................................................481

Share & Embed

More from this user

Recent Readcasters

Add a Comment

Characters: ...

priya@1left a comment

Thanks for sharing !! Nice preview...

raviinterleft a comment

well written

djamer1left a comment

well written, i will buy the entire book.

GnanaDeeptileft a comment

Chapter 7 to Chapter 13 missing in the Pdf

eviltester replied:

Hi, These chapters are a preview 'teaser' to give potential readers an indication of the contents of the book. The book can be bought from http://www.compendiumdev.co.uk/selenium
06 / 20 / 2010

sudha1qaleft a comment

nice document