package club.magicfun.aquila.job;

import java.io.File;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class QuartzJob  {

	public QuartzJob() {
		System.out.println("Quartzjob创建成功");
	}
	
	@Scheduled(cron = "0/10 * *  * * ? ")
    public void run(){
        System.out.println("Quartz执行的任务调度");
        
		String dir = System.getProperty("user.dir");
		System.setProperty("webdriver.chrome.driver", dir + File.separator + "drivers" + File.separator + "win" + File.separator + "chromedriver.exe");
        
        WebDriver webDriver = new ChromeDriver();
        
        //webDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        
        webDriver.get("https://item.taobao.com/item.htm?id=39647261724");  
  
        System.out.println("title: " + webDriver.getTitle());
        
        webDriver.close();  
        webDriver.quit();
    }

}

@@ -621,16 +621,136 @@
 .dir%22);%0A
+%09%09String osName = System.getProperty(%22os.name%22);%0A%09%09%0A%09%09// windows%0A%09%09if (osName.toLowerCase().indexOf(%22windows%22) %3E -1) %7B%0A%09
 %09%09System
@@ -846,17 +846,22 @@
  + %22win%22
- 
+%0A%09%09%09%09%09
 + File.s
@@ -888,24 +888,233 @@
 iver.exe%22);%0A
+%09%09%7D else if (osName.toLowerCase().indexOf(%22mac%22) %3E -1) %7B%0A%09%09%09System.setProperty(%22webdriver.chrome.driver%22, dir + File.separator + %22drivers%22 + File.separator + %22mac%22%0A%09%09%09%09%09+ File.separator + %22chromedriver%22);%0A%09%09%7D%0A
         %0A   

load the appropriate chrome driver accoridng to the os name.