Selenium WebDriver unable to bind to locking port

前端 未结 3 1873
庸人自扰
庸人自扰 2021-01-22 20:13

I am new to the selenium.I am running testcases and I am getting the following exception:

org.openqa.selenium.WebDriverException: Unable to bind to locking port          


        
相关标签:
3条回答
  • 2021-01-22 20:23

    There are some causes for a test to be unable to bind to the locking port. One of the most common is that you do not set a new instance of your Webdriver for each test that you run, or that you have an existing instance of the webdriver that has not been closed.

    If you do not give it a new instance, then Firefox can have multiple instances that may conflict with one another. Creating a new instance is very simple to add to your code. This can be done in one of two ways. The first way, would be to declare a new driver for each test run.

    IWebDriver driver = new FirefoxDriver();
    

    The second is to assign it a specific profile to use. If you want to assign a specific firefox profile to the instance (to just use the bare minimum of the browser) you can use the following code

    FirefoxProfile yourProfile = new FirefoxProfile(@"Filepath of the custom profile");
    using(IWebDriver driver = new FirefoxDriver(yourProfile))
    {
        //Perform your test here
    }
    

    Another cause can be that the last test failed to properly close the webdriver. At the end of your test, just add a way to close your instance. This can be done with a simple

    driver.Close();
    

    More information on this topic from other users can be found here https://groups.google.com/forum/#!topic/selenium-users/scHVivMEYDc

    0 讨论(0)
  • 2021-01-22 20:29

    According to the changelist, FF18 is supported since WebDriver 2.29.0 version.
    So check out the latest version here: http://docs.seleniumhq.org/download/

    Or use direct link: selenium.googlecode.com/files/selenium-java-2.33.0.zip

    0 讨论(0)
  • 2021-01-22 20:34

    Solution 1 - update Firefox version to v19 and selenium version to version 2.31

    Solution 2 - or else follow following steps:- Steps:- 1. Go to following path C:\Windows\System32\drivers\etc 2. And comment out : 127.0.0.1 localhost

    0 讨论(0)
提交回复
热议问题