Saturday, 14 July 2018

Selenium IDE 3.1.1


Selenium IDE

ü Selenium IDE is an  integrated development environment for  Selenium tests.
ü It is implemented as a Firefox extension, and allows you to record, edit, and replay the test in Firefox.
ü Selenium IDE allows you to save tests as HTML, Java, Ruby scripts, or any other format
ü It allows you to automatically add assertions to all the pages.
ü Allows you to add selenese  commands as and when required
ü It’s an easy-to-use Chrome and Firefox extension
ü Record and Play back user action in WebApp
ü Its not Recommended for stable , long staying Test Suites
ü Test only on Chrome, Firefox Browser
Installing the IDE

ü Download the IDE using Chrome or Firefox
ü Click on Add to Chrome or Add to Firefox.
ü After Installation a button will appear on the right hand side of the address bar.

Opening the IDE
ü To run the Selenium IDE, simply click the button to the right of the address bar.
ü It opens as follows with an empty script-editing window and buttons to open a project or save one.













ü  Speed Control: controls how fast your test case runs.
ü  Run All: Runs the entire test suite when a test suite with multiple test cases is loaded.
ü  Run: Runs the currently selected test. When only a single test is loaded this button and the Run All button have the same effect.
ü  Pause/Resume: Allows pausing and resuming of the running test case.
ü  Stop: Stops the current running test case.
ü  Step: Allows you to “step” through a test case by running it one command at a time. Use for debugging test cases.
ü  Record: Records the user’s browser actions.

Recording Selenium Test Case
ü  Open Firefox that has the IDE installed
ü  Open the base URL of the application to record.
ü  Go To Tools  Selenium IDE and the IDE will be opened
ü  Now perform the operations on the application as you are testing the application.
ü  Once you are done with the recording click on the stop recording button and save the test case through the file menu. By default it will be saved as a selenese script (.side format)

Command Table
  • Command : Command column describes name of command.
  • Target :Target column describes Target element id or name or Xpath
  • Value :Value column describes Value of an element














Wait and wait for
ü Selenium IDE will now automatically wait for you, at every command
ü Every command will wait for the page to load.
ü  Commands which take a locator will wait for the element to appear.
ü  Hopefully this will eliminate the need for explicit waiting.
ü  In case that is not enough, the pause command can be used instead.
Recording
ü During recording, Selenium-IDE will automatically insert commands into your test case based on your actions.
ü  Typically, this will include:
§  clicking a link - click or click at commands
§  entering values - type command
§  selecting options from a drop-down listbox - select command
§  clicking check boxes or radio buttons - click command

Verifications and Asserts With the Context Menu
ü While Recording Script, Right Click anywhere on the page.
ü You will see a context menu showing verify and/or assert commands

Editing

ü  Insert Command
            Right-click and select Insert Command
ü  Insert Comment
            Comments may be added to make your test case more readable
ü  Edit a Command or Comment
            Select the line to be changed ,edit it using the Command, Target, Value and Comment fields.

Running Test Cases

ü  Run a Test Case
            Click the Run button to run the currently displayed test case.
ü  Run a Test Suite
            Click the Run All button to run all the test cases in the currently loaded test suite.
ü  Pause and Star
The Pause button can be used to stop the test case while it is running.
The icon of this button then changes to indicate the run is paused.
 To continue click it again, or click the Run button.
ü  Stop in the Middle
            -You can set a breakpoint in the test case to cause it to stop on a particular command.
            -select a command, right-click, and from the context menu select Toggle Breakpoint.
ü  Start from the Middle
-You can tell the IDE to begin running from a specific command in the middle of the test case. 
            -select a command, right-click, and from the context menu click Play from here.
ü  Run Any Single Command
            -Double-click any single command to run it by itself. 

Selenese
Selenium commands known as SELENESE
Sequence of selenese forms test script
Three types of Selenese –
Actions
    • Commands that do user action like click, sendKeys

 Accesors
   •examine / access the current state of application-under test

Assertions
   • Verify/validate the expected results
• Few commands comes with parameters(They are
optional depends on command)

Selenese Commands

  • ·       Open

opens a page using a URL.
  • ·       Click

performs a click operation, and optionally waits for a new page to load.
  • ·       verifyTitle/assertTitle

verifies an expected page title.
  • ·       verifyTextPresent

verifies expected text is somewhere on the page.
  • ·       verifyElementPresent

verifies an expected UI element, as defined by its HTML tag, is present on the page.
  • ·       verifyText

verifies expected text and its corresponding HTML tag are present on the page.
  • ·       verifyTable

verifies a table’s expected contents.

Test Scenario
ü Launch way2sms
ü Type Phone number
ü Type Password
ü Click Login
ü After Page Load Verify text
ü logout

Limitations of Selenium IDE
ü Can run the test only on Firefox.Chrome
ü No Programming login (like loops,conditional statements) can be applied
ü Selenium IDE can execute scripts created in Selenese only.
ü It is difficult to use Selenium IDE for checking complex test cases .

No comments:

Post a Comment