1
resposta

Erro ao abrir o Firefox

Boa noite!

Ao tentar rodar o primeiro código do curso, o console apresenta o seguinte erro:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
    at testes_de_sistema.TesteAutomatizado.main(TesteAutomatizado.java:10)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows: 

Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'bhn-fernandaago', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
    at testes_de_sistema.TesteAutomatizado.main(TesteAutomatizado.java:10)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
    ... 7 more

Alguém pode me ajudar, por gentileza?

1 resposta

Se você estiver usando um ambiente Linux, como o Ubuntu, sugiro:

(1) baixar e descomprimir num diretório o Firefox 46.0

  • para descomprimir o arquivo, execute tar -xjf firefox-46.0.tar.bz2

(2) Antes de iniciar os testes, indique a localização do Firefox na propriedade do sistema webdriver.firefox.bin. Por exemplo:

@Teste
public void testeABC() {
       // Firefox 46.0 instalado nesse diretório
       System.setProperty("webdriver.firefox.bin",  "/home/fernando/firefox/firefox");

       // abre firefox
       this.driver = new FirefoxDriver();

       // ...
}