Amamiyuki 发表于 2017-7-19 11:44:54

求教大神如何解决运行selenium webdriver的程序时7054端口如何解决

自学基于Java的webdriver 照着网上找的一些入门教程写了一段简短的代码,但运行时发生异常,求教各位大神如何解决此问题。

代码为:
package org.coderinfo.demo;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

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)


还有图片



页: [1]
查看完整版本: 求教大神如何解决运行selenium webdriver的程序时7054端口如何解决