Skip to main content

Posts

Showing posts with the label Selenium User Extensions

Add Custom functions to Selenium

We can add custom functions to selenium or extend your selenium jar functions as you want. We can do this in 2 ways. 1. Extending selenium-browserbot.js and selenium-api.js      a. Extract your selenium-server-standalone-xxx.jar to temp folder.      b. Find the files  selenium-browserbot.js and selenium-api.js inside core\scripts\ folder.      c. Add your custom function to class  BrowserBot like below in selenium-browserbot.js.  BrowserBot. prototype . yourFunctionName   =  function ( )   {                     //code here          }      d. Now add your function to class selenium to expose Selenium API like selenium. prototype . yourFunctionName   =  function ( )   {                return   this . browserbot . youFunctionN...