eclipse - How to run my Java Selenium program automatically every hour -
I have developed a test case in Java and Selenium webdriver. I have developed it in Eclipse IDE Can you please tell me whether I want to execute this code every hour. How should I do this? I do not use Maven or anything and I do not know how they work We do. I click on the execute button in all Eclipse IDE. But I want to do it automatically instead of clicking Execute button in Eclipse. Please suggest. This is the one that I want to execute every hour:
wd.get ("http://www.google.com"); Thread.Sleep (100); Web Element Logo = wd.findElement (By.id ("abc")); Logo.click (); Try {getscreenshot (); } Grip (exception e) {// Tudo auto-generated cache block System.out.println ("found an exception"); }} Static Simplified Format Format = New Simple Format ("YYMEMMDHHMSSSA"); Public stabilizes zero () throws exceptions {Calendar now = Calendar.getInstance (); Robot robot = new robot (); BufferedImage screenshot = robot.createcrescache (new rectangle (Toolkit.getDefaultToolkit). GetScreenSize ())); ImageIO.write (screenshot, "jpg", new file ("g: \\ screen output" + formatter.format (now. Gate time) ".jpg")); Println (formatter.format (now.getTime ())); }}
Firstly you export your Java program to executable needed. File Right click on your project Select Export
Then select Runnabel JAR file, click Next, choose your location and export:
Then you can enter your Name name_of_program.bat named .jar and edit it with Notepad: java -jar your_program.jar breakdown < / Code> In the end you will be automatically charged for launching that code. You have to schedule a Windows which should be .bat at any time you want. To see it @HiteshDharmadasani link:
Comments
Post a Comment