Google+

Using Third Party APIs in Selenium Automation

Technically speaking Selenium WebDriver is an API. API is nothing but a set of commands / methods for performing the operations. Selenium WebDriver’s API has set of commands / methods which will help us in performing operations on Web Elements like clicking a button, selection a drop down option, entering text in to the text box fields and so on.



In Selenium Automation, apart from using its own API commands / methods (i.e. Selenium WebDriver API), we need to use other third party API’s for performing the below:


  • Third party API's for implementing various Unit Testing Frameworks in Selenium Automation code. Example: TestNG API is a third API having its own commands which help us in implementing Unit Testing in Selenium Automation Frameworks.
  • Third party API's for implementing the logging in Selenium Automation code. Logging in Selenium Automation helps us in printing the actions that have taken place while the Selenium Automation code is getting executed. Once the execution is completed, by reading logs in log files, we can understand how the program got executed and also can know the error details if any. Example: Log4j API is a third party API which helps us in collecting the logs into a log file while the Selenium Automation code is executing.
  • Third party API's for reading the test data from the Excel files. Reading text data from Excel files is generally used in Selenium Automation for two purposes. One of the purpose is in Keyword driven framework where the Keywords related to the current executing test case are read from the excel files and based on that the corresponding Selenium code gets executed. And the other purpose is to execute the same test cases multiple times with different sets of test data that is available in the Excel files. The second purpose is generally used in the Data Driven Framework. Example: POI API is a third party API having its own commands / methods which helps us in reading the test data from the Excel files. 
  • Third party API's for reporting the results of the executed Selenium Automation tests. Example: Extent Reports API is a third party API which has its own commands / methods which help us in extracting the results the executed test cases and displaying properly in the form of logs, screen-shots and results in a beautiful format in a good looking HTML pages. 
  • And many more other API's which are useful but not listed here. 


Selenium WebDriver API is part of the Selenium project and has commands / methods for performing various operations of the Web Elements like clicking a button, selecting an option from the drop down list, selecting a check box option, entering text into the text field and so on. So in order to automate an application, we don’t have to write the code from scratch, instead we can write the high level code which uses the commands / methods of the Selenium WebDriver API. Developers of Selenium WebDriver API has already done the hard work and has provided us with a set of popular commands / methods which help us in automating the applications. Hence we simply use these commands / methods for automating the application. 

Similar to Selenium WebDriver API, there are other developers who have provided a different API’s for various other things. i.e. There are API’s which help us in extracting logs while the program is executing. And there are API which help us in implementing the Unit Testing in our Program code. And also there are API's which help us in reading text from the Excel files. And also there are API's which help us in generating the good looking reports with the advanced results extraction from the executed tests. But these API’s were developed by a different set of developers and hence these API’s are not part of Selenium WebDriver API. While working with Selenium Automation, we have to use the other Third Party API's for performing various other operations which Selenium WebDriver API wont provide. 

Hence we use third party API's along with Selenium WebDriver API in our Selenium Automation code to perform something that Selenium WebDriver API wont provide. 

No comments: