package test;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
public class GetDriverInfo {
public static void main(String[] args) {
String[] addrs =
new String[] {"001", "002", "003", "004", "005", "006", "007",
"008", "011"};
// <option value="001">公交驾校</option>
// <option value="002">杭州长运</option>
// <option value="003">新塘</option>
// <option value="004">铁路</option>
// <option value="005">浙公校</option>
// <option value="006">杭汽校</option>
// <option value="007">富阳桐江</option>
// <option value="008">浙江经职</option>
// <option value="011">交通职高</option>
Calendar today = Calendar.getInstance();
long todayTime = today.getTimeInMillis();
for (int j = 0; j < addrs.length; j++) {
for (int k = 0; k < 35; k++) {
long newTime = todayTime + k * 3600 * 24 * 1000;
Date newDate = new Date(newTime);
Calendar newCal = Calendar.getInstance();
newCal.setTimeInMillis(newTime);
if (newCal.get(Calendar.MONTH) >= 5) {
break;
}
getContent(addrs[j], newDate);
}
}
}
private static void getContent(String addr, Date newDate) {
String url = "http://www.qc5qc.com/xqc/mlpxfind.php";
// WebDriver driver = new InternetExplorerDriver();
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(url);
String date = "";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
date = df.format(newDate);
Select selectedList = new Select(driver.findElement(By.name("pxd")));
selectedList.selectByValue(addr);
System.out.println("===============");
System.out.println("addr:"
+ selectedList.getFirstSelectedOption().getText());
System.out.println("date:" + date);
WebElement dateElm = driver.findElement(By.id("rq"));
dateElm.clear();
dateElm.sendKeys(date);
driver.findElement(By.name("Submit")).click();
WebElement tbElm =
driver.findElement(By.id("form1"))
.findElement(By.xpath((".//table[2]//table")));
// System.out.println(tbElm.getText());
for (int i = 2; i <= 5; i++) {
String xpathStr = ".//tr[" + i + "]/td[" + 3 + "]";
String oneValue = tbElm.findElement(By.xpath(xpathStr)).getText();
if(!"0".equals(oneValue)) {
System.out.println("oneValue:" + oneValue);
}
// System.out.println(oneValue);
}
driver.close();
}
}
分享到:
相关推荐
实现程序的主要函数有四个: GetOsVersion() //取得操作系统版本 GetMemInfo() //取得内存信息 GetDriverInfo() //取得驱动器信息 GetCpuInfo() //取得CPU信息,这里只是读取了注册表的ProcessorNameString具体代码...
- `GetDriverInfo()`函数用于填充`LPECDINFO`结构体,包含驱动的版本、分类、供应商、名称、通信描述等信息。 4. **开发包文件说明**: - `ecdriver.h`:包含了驱动回调函数和结构的定义,这是驱动与上层应用程序...
4. **驱动模块信息**:源码可能会演示如何获取驱动模块的详细信息,如驱动名称(DriverName)、驱动文件路径(DriverPath)、驱动状态(DriverStatus)等,这些信息可以通过系统API如`GetDriverInfo`获取。...
- **`getDriverInfo()`**:获取驱动的信息,包括版本号等。 - **`canSampleRate(double)`**:确定驱动是否支持指定的采样率。 - **`setSampleRate(double)`**:设置当前的采样率。 - **`getLatencies()`**:获取输入...
易语言API取操作系统信息源码,API取操作系统信息,GetOsVersion,GetCpuInfo,GetMemInfo,GetDriverInfo,GetInfo,GetModuleHandle,DialogBoxParam,EndDialog,GetVersion,ExitProcess,SetDlgItemText,GetDlgItemText,...