import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 定时器:
*/
@Component
public class TaskService {
/**
* eg: cron = "0 30 10 * * ?" 表示在10:30点启动任务
*/
@Scheduled(cron = "0 30 10 * * ?")
public void sendJob() throws InterruptedException {
***
}
}
public static void job() throws InterruptedException {
ChromeOptions options = new ChromeOptions();
options.addArguments("--ignore-certificate-errors");
options.addArguments("--start-maximized");
// 建立selenium 驱动
WebDriver driver = new ChromeDriver(options);
// 目标地址
driver.get("http://baidu.com");
}