@@ -0,0 +1,2229 @@
+package club.magicfun.aquila.job;%0A%0Aimport java.io.File;%0Aimport java.util.List;%0A%0Aimport org.openqa.selenium.By;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.WebElement;%0Aimport org.openqa.selenium.chrome.ChromeDriver;%0A%0Apublic class TestWebDriver %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%0A%09%09String dir = System.getProperty(%22user.dir%22);%0A%09%09String osName = System.getProperty(%22os.name%22);%0A%09%09%0A%09%09// load the appropriate chrome drivers according to the OS type%0A%09%09if (osName.toLowerCase().indexOf(%22windows%22) %3E -1) %7B%0A%09%09%09System.setProperty(%22webdriver.chrome.driver%22, dir + File.separator + %22drivers%22 + File.separator + %22win%22%0A%09%09%09%09%09+ File.separator + %22chromedriver.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%09%09%0A%09%09WebDriver webDriver = new ChromeDriver();%0A        %0A        //webDriver.get(%22https://item.taobao.com/item.htm?id=12718544734%22); // normal%0A        webDriver.get(%22https://item.taobao.com/item.htm?id=41671173269%22); // promo%0A        %0A        //webDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);%0A        %0A        System.out.println(%22title: %22 + webDriver.getTitle());%0A  %0A        List%3CWebElement%3E colorCategoryList = webDriver.findElements(By.xpath(%22//*%5B@data-property='%E9%A2%9C%E8%89%B2%E5%88%86%E7%B1%BB'%5D/li/a%22));%0A        %0A        for (WebElement colorCategory : colorCategoryList) %7B%0A        %09%0A        %09// simulate choosing a color%0A        %09colorCategory.click();%0A        %09%0A        %09//webDriver.manage().timeouts().implicitlyWait(500, TimeUnit.MICROSECONDS); %0A        %09%0A        %09WebElement selectedColorLi = webDriver.findElement(By.xpath(%22//*%5Bcontains(concat(' ', normalize-space(@class), ' '), ' tb-selected ')%5D%22));%0A        %09System.out.println(%22selectedLi: %22 + selectedColorLi.findElements(By.cssSelector(%22a %3E span%22)).get(0).getAttribute(%22innerHTML%22));%0A        %09%0A        %09System.out.println(%22price: %22 + webDriver.findElement(By.id(%22J_PromoPriceNum%22)).getText());%0A        %09System.out.println(%22stock: %22 + webDriver.findElement(By.id(%22J_SpanStock%22)).getText());%0A        %09%0A        %7D%0A        %0A        webDriver.close();  %0A        webDriver.quit();%0A%09%09%0A%09%7D%0A%0A%7D%0A

test webdriver