System.setProperty("Webdriver.chrome.driver", "F:/shiva testing/chromedriver.exe");
//System.out.println("hai");
WebDriver driver=new ChromeDriver();
driver.get("http://newtours.demoaut.com/");
String underConsTitle= "Under Construction : Mercury Tours";
//driver.get("http://www.google.co.in/");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
java.util.List<WebElement>linkElements =driver.findElements(By.tagName("a"));
String[]linkText=new String[linkElements.size()];
int i=0;
for(WebElement e:linkElements)
{
linkText[i]= e.getText();
i++;
}
for(String t: linkText)
{
((WebElement) driver.findElements(By.linkText(t))).click();
if(driver.getTitle().equals(underConsTitle))
//if (driver.getTitle().equals(underConsTitle))
{
System.out.println("\"" +t+"\"" +"is under construction");
}
else
{
System.out.println("\"" +t+"\"" +"working");
}
driver.navigate().back();
The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:177) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:117) at mypackage.Getalllinks.main(Getalllinks.java:22)
答案 0 :(得分:1)
你的问题在第1行,它应该是:
System.setProperty("webdriver.chrome.driver", "F:/shiva testing/chromedriver.exe");
请注意“webdriver”的大小写!
答案 1 :(得分:0)
您的问题是webdriver.chrome.driver
密钥区分大小写,不仅是此密钥,而且所有密钥都区分大小写。