public class TestEnv {
public static void main(String[] args) {
System.setProperty("webdriver.firefox.bin", "D:\\Program Files\\Mozilla Firefox\\firefox.exe" );
WebDriver driver = new FirefoxDriver();
driver.get("http://www.baidu.com");
System.out.println("page title is:"+driver.getTitle());
}
}
报错信息为:
Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.7.0', revision: '13926', time: '2011-09-23 13:24:59'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:95)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:70)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:149)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:72)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:79)
at org.coderinfo.demo.TestEnv.main(TestEnv.java:11)