This is my code:

package testpk;

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

public class Testing9 {
    public static void main(String[] args)
        WebDriver driver = new FirefoxDriver();

I'm getting error like this:

at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:99)
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:80)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    at testpk.Testing9.main(Testing9.java:9)
  • What have you tried? Did you even google parts of the error? Mar 9, 2019 at 10:10

2 Answers 2


You only added a partial error. It is missing the actual error, you only show the start of the stack trace.

But org.openqa.selenium.internal.SocketLock.lock most often means that another program is already using that socket number, or an older session is running in the background. Computers only have a limited number of network sockets/ports available, they can also be used only once at a time.

Here are some tips to resolve it: https://stackoverflow.com/questions/13992986/unable-to-bind-to-locking-port-7054-within-45000-ms-webdriver-firefox

Probably restarting your system will also help, as it will free up the socket currently in use.


Deleting all tmp files and restarting system may help. Check below links https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4790


Hope this helps you.

Not the answer you're looking for? Browse other questions tagged or ask your own question.