51Testing软件测试论坛

标题: 求教大神如何解决运行selenium webdriver的程序时7054端口如何解决 [打印本页]

作者: Amamiyuki    时间: 2017-7-19 11:44
标题: 求教大神如何解决运行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)


  还有图片
[attach]107666[/attach]







欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2