Thursday 25 October 2018

How to run Selenium scripts using batch file and schedule every day?

How to run Selenium scripts using batch file and schedule every day?


Generally we would like to have our automation suite to be scheduled so that it runs based on the scheduler settings. So I am assuming you will have TestNG suite (.xml) which you are planning to run. 

To achieve scheduling dividing tasks as below: 

1. Create batch file for the TestNG xml executed. 

We can create batch file with following content: 

set classpath=C:\Sel_WS\MySelenium\bin;C:\Srinivas Kini\Selenium_New\libs\*;C:\Srinivas Kini\Selenium Installers\eclipse-jee-mars-1-win32\eclipse\plugins\org.testng.eclipse_6.11.0.201703011520\lib\*;

java org.testng.TestNG TestNG.xml

pause


Here TestNG.xml is the TestNG suite we would like to execute. 



2. Add suite in OS scheduler. For windows, steps are given below: 

Open Task Scheduler from Start --> Programs

click on "Create Basic Task"


click Next and provide name to your task


Select Schedule interval and time and other parameters


Select "Start a Program" radio

Browse to the batch files path and select it


click on Finish. 


Now your program is scheduled to run :-). 

If you have any questions about this do write in comment below. 

Hope this blog has been useful to you. If yes do follow my blogs by entering your email by 
clicking on "Follow" (blue) button. 

You can as well explore my 

Youtube Channel: https://www.youtube.com/user/srinivaskinik

And 

facebook page: https://www.facebook.com/srinivaskinikalmady/

Thank you.











No comments:

Post a Comment

How to schedule RFT (Rational Functional Tester) scripts to run using Jenkins / schedule

How to schedule RFT (Rational Functional Tester) scripts to run using Jenkins / schedule 1. Create a batch file with following content ...