eBook Learning Selenium in 6 Easy Steps

download eBook Learning Selenium in 6 Easy Steps

of 16

Transcript of eBook Learning Selenium in 6 Easy Steps

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    1/16

    Learning Seleniumin 6 Easy StepsA CYGNET INFOTECH E-BOOK

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    2/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    Today, when web applications are developsegment of industry and for every size of bualso become very important to check its effi

    launching it on the board. Though the effetesting applications varies from a company tois accepted as an essential part of the proces

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    3/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    When testing is such an important task for an organization,can indeed be called a blessing.Selenium, a widely used opweb application test automation tool can be very useful to of people who work on manual testing. It is becoming theof testers for testing GUI as well as the functionalities ofapplications.

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    4/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    Selenium IDEA Firefox extension to record test cas

    SelenUsed to

    different

    sy

    Selenium GridRuns multiple instances

    of Selenium RC at once

    Selenium is a package containing

    various test components whichconsists of the following four major

    tools.

    Each one of them has a specific role

    in aiding the development of testautomation for a Web application.

    Selenium WebDrivA well-designed object-oriented API timproved support for modern advan

    testing problems.

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    5/16

    6 Easy Steps forLearning Selenium

    E-book: Learning Selenium in 6 Easy Steps

    1 2 3 4 5 6

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    6/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    You need a framework to work with Selenium before g

    Write some simple coding to run your automation sc

    browsers. Though there are many frameworks available i

    we would consider Eclipsehere which is again an open sis also well known tool which is behave same like STS. And

    no change in configuration area if you are using Eclipse.

    Download E

    http://www.eclipse.org/downloads/http://www.eclipse.org/downloads/
  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    7/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    Now, it is the time to select a language to

    go ahead. We would prefer Java and thus,

    give you guidelines accordingly.

    First Download Selenium Libraries

    For Selenium Webdriver you should get linkon location displayed in image.

    http://docs.seleniumhq.org/download/http://docs.seleniumhq.org/download/
  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    8/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    The actual work will start now.

    Open Eclipse tool.

    1. Create one Java Project from the path

    2. Enter project name and select location to save the

    project

    3. ClickNext button once it enable.

    4. ClickLibraries tab.

    5. Click dd External Jars button.6. Select the Client Driver Java Jar file from the computer

    location you just download.

    7. Click inish button once you done.

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    9/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    Another way to add jar file is given below.

    1. Createjava Projectjust by entering name

    2. Selectlocation

    3. Click inish button.

    4. Once project is created, right click onproject name

    Once you done w

    you can start writscripts. Added jar

    displayed under

    Libraries.

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    10/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6Scripting can be written in Class file hence you need to create class

    Java Project. Class file can be created from the path

    If you are scared to write test cases in class, then Selenium IDE is the

    It will create class code for you for that you just need to understan

    record the actions for which automation script is require.

    Selenium IDE This is a Firefox Add-on (download it here). Selenium IDE and install.

    IDE supports only Firefox hence we are using Selenium RC to run al

    scripts on different browsers. You can export recorded steps into

    language format.

    http://seleniumhq.org/download/http://seleniumhq.org/download/
  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    11/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    Base URL: http://www.google.co.in

    Command Target Value

    open /

    click id=gbqfq

    type id=gbqfq Testing

    click id=gbqfq

    1 2 3 4 5 6

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    12/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    Now its time to run test case. Run is possible in many ways. One of the easiest ways is JUnit.

    JUnit is used to run code internally which is mostly used by developer. You can use it like this:

    Right click on Class file

    Select Run s

    JUnit Test

    There is one more tool available

    which is used for report

    creation and mostly used by

    Testers named as TestNG.

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    13/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    Download TestNG jar file from: http://beust.com/eclipse

    To run code using TestNG it should be installed in your framework. To install it follow below

    1. Go to HelpInstall New Software..

    2. Click Add button3. Enter name as TestNG and location as http://beust.com/eclipse.

    4. Click OK button.

    5. Check TestNG checkbox and click Next button.

    6. Finish the process.

    7. Restart the STS or Eclipse to take effect.

    TestNG can be used to create selenium report in some good format for a

    cases. For that you need to configure it in your project. Configuratio

    adding a jar file for TestNG into your project and installing it in Framewo

    or STS.

    E b k L i S l i W bd i i 6 E St

    http://beust.com/eclipsehttp://beust.com/eclipsehttp://beust.com/eclipsehttp://beust.com/eclipsehttp://beust.com/eclipse
  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    14/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    1 2 3 4 5 6

    Keep in mind that while you are running

    script with TestNG, your selenium should

    start before. TestNG provides facility to run

    all test cases at same time. For that you need

    to create one XML file. XML file will look like

    The problem you will face is the format of code that you write for selenium

    uses its own coding standard to interact with selenium or any other langsimple to understand so we will also use the same for some example.

    E book Learning Seleni m Webdri er in 6 Eas Steps

  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    15/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    Steps to create XML file.

    1. Right click on project.

    2. Go to TestNGConvert to TestNG3. Verify that testng.xml file created under your project.

    4. Open file, it will look like above image.

    Now, you can run your script(s) using TestNG.

    1. Right click on testng.xml file

    2. Go to Run asTestNG Suite

    3. Wait till test case run.

    4. Your will get good report format which can also be

    open in browser.

    1 2 3 4 5 6

    Refer this link to get more understanding of selenium with given live sc

    E book: Learning Selenium Webdriver in 6 Easy Steps

    http://testng.org/doc/selenium.htmlhttp://testng.org/doc/selenium.html
  • 8/10/2019 eBook Learning Selenium in 6 Easy Steps

    16/16

    E-book: Learning Selenium Webdriver in 6 Easy Steps

    Phone:

    India +91-79-30087900

    USA: +1-201-600-9012UK: +44-20-8099-1653

    Email: inquiry@cygnet-infote

    Website: http://cygnet-infote

    In this e-book, we have tried to

    explain Selenium WebDriver and

    configuring Eclipse with SeleniumWebDriver. We hope this will be

    quite helpful for you to

    understand the process.

    mailto:[email protected]://cygnet-infotech.com/http://cygnet-infotech.com/mailto:[email protected]