下面是代码。
public void waitForWebavailability() throws Exception {
boolean success = false;
long waitTime = 0;
while (!success) {
try {
waitTest(30000);
waitTime += 30000;
if (waitTime > 600000) {
System.out.println("Web page is not available");
}
webDriver.get("http://www.google.com");
if (webDriver.getTitle().toLowerCase().contains("sometitle")) {
success = true;
}
} catch (Exception e) {
success = false;
}
}
}
// Code related to waittest
public void waitTest(long millis) throws Exception {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new Exception(e);
}
}
Android Studio无法解析webDriver行。