Wednesday, March 26, 2014

Selenium IDE

Selenium IDE

Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension simply we can say like selenium via FF plugin and allows you to record, edit, and debug tests. Selenium IDE includes the entire Selenium Core, allowing you to easily and quickly record and play back tests in the actual environment that they will run. Selenium IDE is the easiest way to use Selenium and most of the time it also serves as a starting point for your automation. As compared to most of the test automation tools it is very simple and lightweight.


Advantages: Selenium IDE is the only flavor of Selenium, which allows you to record user action on browser window. It can also record user actions in most of the popular languages like Java, C#, Perl, Ruby etc. This eliminates the need of learning new vendor scripting language. For executing scripts created in these languages, you will need to use Selenium Remote Control. If you do not want to use Remote Control than you will need to create your test scripts in HTML format.


Disadvantages: Biggest drawback of Selenium IDE is its limitation in terms of browser support. Though Selenium scripts can be used for most of the browser and operating system, Scripts written using Selenium IDE can be used for only Firefox browser if it is not used with Selenium RC or Selenium Core.

Features:

1. Easy record and playback.
2. Intelligent field selection will use IDs, names, or XPath as needed.
3. Autocomplete for all common Selenium commands.
4. Walk through tests.
5. Debug and set breakpoints.
6. Save tests as HTML, Ruby scripts, or any other format.
7. Support for Selenium user-extensions.js file.
8. Option to automatically assert the title of every page.

Advantages of Selenium:

1. It is an Open source
2. Simple, Easy to learn, install, Easy to work
3. Selenium IDE is the only flavor of Selenium which allows you to record user action on browser window
4. Can also record user actions in most of the popular languages like Java, C#, Perl, Ruby
5. It will not record any operation that you do on your computer apart from the events on Firefox browser window.
6. During recording if you right click on any element it will show all the selenium commands available
7. We can also edit existing command, by selecting it and editing on the boxes available
8. We can also insert/delete commands by choosing appropriate option after right clicking Choose appropriate run option – i.e walk, run or test runner and review your results
9.You can convert my script to html,java,perl ....and more .To convert into your favourite language , use Options->Format->"favourite language" in Selenium IDE

Disadvantages of Selenium:

1. Limitation in terms of browser support (It runs only in Firefox).Scripts written using Selenium IDE can be used for other browsers only if it is used with Selenium RC or Selenium Core.
2. We can’t run recorded script if it is converted to Java, C#, Ruby etc.
3. Not allowed to write manual scripts like conditions and Loops for Data Driven Testing
4. There is no option to verify images.


Selenium commands come in three “flavors”:

Actions are commands that generally manipulate the state of the application. They do things like “click this link” and “select that option”. If an Action fails, or has an error, the execution of the current test is stopped.
Many Actions can be called with the “AndWait” suffix, e.g. “clickAndWait”. This suffix tells
Selenium that the action will cause the browser to make a call to the server, and that Selenium should wait for a new page to load.

Accessors examine the state of the application and store the results in variables, e.g. “storeTitle”. They are also used to automatically generate Assertions.

Assertions are like Accessors, but they verify that the state of the application conforms to what is expected. Examples include “make sure the page title is X” and “verify that this checkbox is checked”. All Selenium Assertions can be used in 3 modes: “assert”, “verify”, and ” waitFor”.
For example, you can “assertText”, “verifyText” and “waitForText”. When an “assert” fails, the test is aborted. When a “verify” fails, the test will continue execution, logging the failure. This allows a single “assert” to ensure that the application is on the correct page, followed by a bunch of “verify” assertions to test form field values, labels, etc.






Commonly Used Selenium Commands:

To conclude our introduction of Selenium, we’ll show you a few typical Selenium commands. These are probably the most commonly used commands for building tests.

open opens a page using a URL.
click/clickAndWait 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 it’s corresponding HTML tag are present on the page.
verifyTable verifies a table’s expected contents.
waitForPageToLoad pauses execution until an expected new page loads. Called automatically when clickAndWait is used.
waitForElementPresent pauses execution until an expected UI element, as defined by its HTML tag, is present on the page.


No comments:

Post a Comment