Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
856 views
in Technique[技术] by (71.8m points)

selenium - Unable to bind to locking port 7054 within 45000 ms

While running automation in webdriver standalone server, i get this exception randomly. Once it comes, I killed all java process . So what is the solution for this exception ? Why it comes randomly ?

Unfortunately as far as i know, all have suggested to use latest version of selenium jar or come compatible firefox version depending on the selenium version or they have said to check if that port is on use (though it won't!) or reboot system.Few have suggested to uninstall firefox version and reinstall it. Any permanent solution or any idea why it comes?

org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms 
Build info: version: '2.30.0', revision: 'dc1ef9c', time: '2013-02-19 00:15:27' 
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0' 
Driver info: driver.version: FirefoxDriver 
Command duration or timeout: 47.94 seconds 
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 15:53:30' 
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0' 
Driver info: org.openqa.selenium.remote.RemoteWebDriver
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Seems like previous webDriver instance (or something else) didn't release the port. Here is workaround (bad practice) for this problem (Java):

 public static FirefoxBrowser forceInit() {
        try {
            return new FirefoxBrowser();
        } catch (WebDriverException exc) {
            return forceInit();
        }
    }

Make sure your tests close driver correctly by:

   driver.quit(); 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...