package test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class GetUrlAndTitle {
public static void main(String []args)
{
String url="www.baidu.com";
WebDriver driver =new FirefoxDriver();
driver.get(url);
String Title=driver.getTitle();
String currentUrl=driver.getCurrentUrl();
System.out.print(Title+"\n"+currentUrl);
}
}
报错:Exception in thread "main" org.openqa.selenium.WebDriverException: f.QueryInterface is not a function
解决方案:String url="www.baidu.com";=》String url="http://www.baidu.com";