Watch out, you are going to bump into the final post of Selenium IDE series very soon. So time to plan for a better living in the coming future! Let’s do this by taking a quick peek at a couple of the available plugins!
There are a number of plugins available in the official website and you can download from their respective sections on the page, http://docs.seleniumhq.org/download/.
Screenshot on Fail
When a test step fails, it is really important to grab a screenshot so that it can be reported accordingly. In Selenium WebDriver it is quite simple to achieve through programming languages. This plugin was developed to attain the same result in Selenium IDE. Once it is installed and turned on, at the point of test failure, the entire web page is captured. The best part is, you have the option to specify a custom location to save these screenshots under respective project folders for future reference or easy identification.
Let us see the download and installation process first.
Under ‘Selenium IDE Plugins’, click on the download link for ‘ScreenShot on Fail’.
You will be redirected to the Add-ons page on Firefox where you can find screenshots and a description of the plugin along with the ‘Add to Firefox’ button.
Clicking on the ‘Add to Firefox’ button would prompt as below,
Click ‘Install’ and ‘Restart Now’ buttons.
The plugin will now be automatically added to Selenium IDE and it will appear on the toolbar.
Clicking on the dropdown arrow shows the options to view the failure screenshots and to customize the location where the report is saved.
Let us do that first! To customize the location of the destination folder where the failure reports will be stored on our system, click on ‘Change reports folder’ and browse the path as required. Click on ‘Select Folder’ to confirm the selection.
Let us see an example to understand how it all works!
- Open ‘https://www.google.com/’
- Assert the page title as ‘Google’
- Verify if the button ‘Google Search’ is present
- Verify if ‘Gmail’ is present with the hyperlink
- Click on the ‘Gmail’ link and wait until the page loads
- Try to verify something that is not available on the page in order to fail the test case.
In order to proceed, make sure to turn on the plugin by clicking once on the ‘ScreenShot on Fail’ button that is seen in the toolbar. Play the test case and it will fail at the last step as that particular web element will not be found.
Once the test case execution is complete click the plugin button again to turn it off. To view the failure report there are two ways,
- Click on ‘View failure report’ from the plugin button dropdown to open the report in a new tab of the currently open Firefox browser.
- Or navigate to the customized path in the system. A new folder named with the timestamp will be created and error screenshots will be saved in it. This feature is very useful when numerous test cases covering different projects are to be executed. Error screenshots can be saved in their corresponding project paths for reference.
Similar to ‘ScreenShot on Fail’, this plugin can also be downloaded from the official site’s downloads page under ‘Selenium IDE Plugins’ section.
Once download link is clicked, you will be redirect to Add-ons page. Click on ‘Add to Firefox’ button. Install and restart the browser.
Upon opening Selenium IDE window, in the Log/Reference pane, a new ‘File Logging’ tab is seen which will be off by default. Click on the dropdown to choose Log File path and the Log Level.
These settings can be performed in two ways,
- Click ‘File Logging’ tab dropdown and click on ‘Show Options…’
- Or ‘Options’ -> ‘Options…’ from the menu bar and click on ‘File Logging’ tab.
Click on ‘Browse’ button to navigate to the desired path and give a file name. If multiple test cases are executed with the same Log File path and name, then the logs will be appended. In case a prompt to overwrite the logs appears, just click ‘yes’. This is an issue in the plugin but nothing to be worried about. Also, if you wish to stop logging, then leave the file name as blank.
Choose the level from the ‘File Logging Level’ dropdown – Debug, Info, Warn or Error. This logging level is independent from the log level that is chosen from the ‘Log/Reference’ pane to display.
Click respective checkboxes as per your need to log timestamp along with the messages, save them in Unicode and use a separate log file for scheduled jobs.
Click ‘OK’ button to save the changes made.
Let us execute the same example and check the log file at the chosen location. As shown in the below screenshot, I have chosen ‘Error’ level for display logs and ‘Info’ level for logging to a file.
Info level logs are written to the file in the chosen path.
Hope these two plugins give you an overall picture of how in general Selenium IDE plugins can be downloaded, installed and used as per your necessity and convenience. These special features can really come in handy during your tough times! So do explore and give me a shout in the comments section in case you have any queries.
See you again in another post. Have a great day!<< 7p. Selenium IDE – Other Features 7r. Selenium IDE – Pause and Reflect >>