How to specify the Selenium Firefox WebDriver port?

0

I'm having the following error with Selenium Firefox Webdriver

  

Exception in thread "main" org.openqa.selenium.WebDriverException:   Unable to bind to locking port 7054 within 45000 ms Build info:   version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'   System info: host: '***', ip: '192.168.100.1', os.name: 'Windows',   os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101' Driver   info: driver.version: FirefoxDriver 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. (RemoteWebDriver.java:119)   at   org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:218)   at   org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:211)   at   org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:207)   at   org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:124)

This problem arises when I am running my program for the second time (I have some test running with the firefox webdriver).

Is it possible to use the firefox webdriver from 2 java programs? Do I have to modify the port? How do I do it?

    
asked by JoseCampos 07.09.2016 в 21:06
source

1 answer

0

After a bit Google-fu I found several threads on the subject:

link

link

First of all, update everything to the most modern versions if you can.

I make a summary of possible solutions that comment on the links:

  
  • Increase the timeout (by default to 45 seconds) like this:
  •   
    FirefoxProfileffProfile = new FirefoxProfile();
    FirefoxBinary ffBinary = new FirefoxBinary();
    ffBinary.setTimeout(TimeUnit.SECONDS.toMillis(180));
    WebDriver webDriver = new FirefoxDriver(ffBinary, ffProfile);
    
      
  • Change the port (default 7054):
  •   
    FirefoxProfileffProfile = new FirefoxProfile();
    ffProfile.setPreference(FirefoxProfile.PORT_PREFERENCE, aCustomPort);
    
      
  • Synchronize any creation of the firefox webServer
  •   

    The idea is to synchronize the code returned by the WebDriver.

        
    answered by 08.09.2016 в 07:49