Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Dúvida Aula 1: Firefox não executa o teste

Olá,

Estou usando o "selenium-server-standalone-2.53.1.jar" e Firefox atualizado.

Meu código esta abaixo, mas quando executo a Classe o Firefox abre mas não abre a URL.

No navegador sob um alerta com esse link: https://support.mozilla.org/t5/Fix-slowness-crashing-error/Accessibility-not-available-during-multi-process-support/ta-p/34610

Segue também o log que o Eclipse gerou

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

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

        driver.get("https://www.google.com.br/");
        WebElement campoDeTexto = driver.findElement(By.name("q"));

        campoDeTexto.sendKeys("Alura");
        campoDeTexto.submit();
    }
}
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
ications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
1486512686068    addons.xpi    DEBUG    getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1486512686069    DeferredSave.extensions.json    DEBUG    Save changes
1486512686069    addons.xpi    DEBUG    Updating database with changes to installed add-ons
1486512686070    addons.xpi-utils    DEBUG    Updating add-on states
1486512686071    addons.xpi-utils    DEBUG    Writing add-ons list
1486512686079    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1486512686080    addons.xpi    DEBUG    Calling bootstrap method startup on aushelper@mozilla.org version 1.0
1486512686082    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1486512686083    addons.xpi    DEBUG    Calling bootstrap method startup on e10srollout@mozilla.org version 1.7
1486512686084    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1486512686085    addons.xpi    DEBUG    Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1486512686087    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1486512686087    addons.xpi    DEBUG    Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1486512686091    addons.manager    DEBUG    Registering shutdown blocker for XPIProvider
1486512686092    addons.manager    DEBUG    Provider finished startup: XPIProvider
1486512686093    addons.manager    DEBUG    Starting provider: LightweightThemeManager
1486512686093    addons.manager    DEBUG    Registering shutdown blocker for LightweightThemeManager
1486512686093    addons.manager    DEBUG    Provider finished startup: LightweightThemeManager
1486512686094    addons.manager    DEBUG    Starting provider: GMPProvider
1486512686105    addons.manager    DEBUG    Registering shutdown blocker for GMPProvider
1486512686106    addons.manager    DEBUG    Provider finished startup: GMPProvider
1486512686106    addons.manager    DEBUG    Starting provider: PluginProvider
1486512686107    addons.manager    DEBUG    Registering shutdown blocker for PluginProvider
1486512686108    addons.manager    DEBUG    Provider finished startup: PluginProvider
1486512686108    addons.manager    DEBUG    Completed startup sequence
[GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0
Crash Annotation GraphicsCriticalError: |[0][GFX1]: D3D11 device creation failed: 0x887a0004 (t=5.35032) [GFX1]: D3D11 device creation failed: 0x887a0004
1486512687791    addons.manager    DEBUG    Starting provider: <unnamed-provider>
1486512687791    addons.manager    DEBUG    Registering shutdown blocker for <unnamed-provider>
1486512687792    addons.manager    DEBUG    Provider finished startup: <unnamed-provider>
1486512688069    DeferredSave.extensions.json    DEBUG    Write succeeded
1486512688069    addons.xpi-utils    DEBUG    XPI Database saved, setting schema version preference to 19
1486512688069    DeferredSave.extensions.json    DEBUG    Starting timer
1486512688092    DeferredSave.extensions.json    DEBUG    Starting write
1486512689179    addons.repository    DEBUG    No addons.json found.
1486512689180    DeferredSave.addons.json    DEBUG    Save changes
1486512689185    DeferredSave.addons.json    DEBUG    Starting timer
1486512689237    addons.manager    DEBUG    Starting provider: PreviousExperimentProvider
1486512689237    addons.manager    DEBUG    Registering shutdown blocker for PreviousExperimentProvider
1486512689237    addons.manager    DEBUG    Provider finished startup: PreviousExperimentProvider
1486512689258    DeferredSave.addons.json    DEBUG    Starting write
Crash Annotation GraphicsCriticalError: |[C0][GFX1]: Potential driver ver1486512689295    DeferredSave.extensions.json    DEBUG    Write succeeded
1486512689348    DeferredSave.addons.json    DEBUG    Write succeeded
sion mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0 (t=3.54847) [GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    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 TesteAutomatizado.main(TesteAutomatizado.java:8)
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: 
ications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
1486512686068    addons.xpi    DEBUG    getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1486512686069    DeferredSave.extensions.json    DEBUG    Save changes
1486512686069    addons.xpi    DEBUG    Updating database with changes to installed add-ons
1486512686070    addons.xpi-utils    DEBUG    Updating add-on states
1486512686071    addons.xpi-utils    DEBUG    Writing add-ons list
1486512686079    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1486512686080    addons.xpi    DEBUG    Calling bootstrap method startup on aushelper@mozilla.org version 1.0
1486512686082    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1486512686083    addons.xpi    DEBUG    Calling bootstrap method startup on e10srollout@mozilla.org version 1.7
1486512686084    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1486512686085    addons.xpi    DEBUG    Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1486512686087    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1486512686087    addons.xpi    DEBUG    Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1486512686091    addons.manager    DEBUG    Registering shutdown blocker for XPIProvider
1486512686092    addons.manager    DEBUG    Provider finished startup: XPIProvider
1486512686093    addons.manager    DEBUG    Starting provider: LightweightThemeManager
1486512686093    addons.manager    DEBUG    Registering shutdown blocker for LightweightThemeManager
1486512686093    addons.manager    DEBUG    Provider finished startup: LightweightThemeManager
1486512686094    addons.manager    DEBUG    Starting provider: GMPProvider
1486512686105    addons.manager    DEBUG    Registering shutdown blocker for GMPProvider
1486512686106    addons.manager    DEBUG    Provider finished startup: GMPProvider
1486512686106    addons.manager    DEBUG    Starting provider: PluginProvider
1486512686107    addons.manager    DEBUG    Registering shutdown blocker for PluginProvider
1486512686108    addons.manager    DEBUG    Provider finished startup: PluginProvider
1486512686108    addons.manager    DEBUG    Completed startup sequence
[GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0
Crash Annotation GraphicsCriticalError: |[0][GFX1]: D3D11 device creation failed: 0x887a0004 (t=5.35032) [GFX1]: D3D11 device creation failed: 0x887a0004
1486512687791    addons.manager    DEBUG    Starting provider: <unnamed-provider>
1486512687791    addons.manager    DEBUG    Registering shutdown blocker for <unnamed-provider>
1486512687792    addons.manager    DEBUG    Provider finished startup: <unnamed-provider>
1486512688069    DeferredSave.extensions.json    DEBUG    Write succeeded
1486512688069    addons.xpi-utils    DEBUG    XPI Database saved, setting schema version preference to 19
1486512688069    DeferredSave.extensions.json    DEBUG    Starting timer
1486512688092    DeferredSave.extensions.json    DEBUG    Starting write
1486512689179    addons.repository    DEBUG    No addons.json found.
1486512689180    DeferredSave.addons.json    DEBUG    Save changes
1486512689185    DeferredSave.addons.json    DEBUG    Starting timer
1486512689237    addons.manager    DEBUG    Starting provider: PreviousExperimentProvider
1486512689237    addons.manager    DEBUG    Registering shutdown blocker for PreviousExperimentProvider
1486512689237    addons.manager    DEBUG    Provider finished startup: PreviousExperimentProvider
1486512689258    DeferredSave.addons.json    DEBUG    Starting write
Crash Annotation GraphicsCriticalError: |[C0][GFX1]: Potential driver ver1486512689295    DeferredSave.extensions.json    DEBUG    Write succeeded
1486512689348    DeferredSave.addons.json    DEBUG    Write succeeded
sion mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0 (t=3.54847) [GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0

Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Carlos-PC', ip: '192.168.0.104', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.7.0_79'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:124)
    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 TesteAutomatizado.main(TesteAutomatizado.java:8)
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:
ications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
1486512686068    addons.xpi    DEBUG    getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1486512686069    DeferredSave.extensions.json    DEBUG    Save changes
1486512686069    addons.xpi    DEBUG    Updating database with changes to installed add-ons
1486512686070    addons.xpi-utils    DEBUG    Updating add-on states
1486512686071    addons.xpi-utils    DEBUG    Writing add-ons list
1486512686079    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1486512686080    addons.xpi    DEBUG    Calling bootstrap method startup on aushelper@mozilla.org version 1.0
1486512686082    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1486512686083    addons.xpi    DEBUG    Calling bootstrap method startup on e10srollout@mozilla.org version 1.7
1486512686084    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1486512686085    addons.xpi    DEBUG    Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1486512686087    addons.xpi    DEBUG    Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1486512686087    addons.xpi    DEBUG    Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1486512686091    addons.manager    DEBUG    Registering shutdown blocker for XPIProvider
1486512686092    addons.manager    DEBUG    Provider finished startup: XPIProvider
1486512686093    addons.manager    DEBUG    Starting provider: LightweightThemeManager
1486512686093    addons.manager    DEBUG    Registering shutdown blocker for LightweightThemeManager
1486512686093    addons.manager    DEBUG    Provider finished startup: LightweightThemeManager
1486512686094    addons.manager    DEBUG    Starting provider: GMPProvider
1486512686105    addons.manager    DEBUG    Registering shutdown blocker for GMPProvider
1486512686106    addons.manager    DEBUG    Provider finished startup: GMPProvider
1486512686106    addons.manager    DEBUG    Starting provider: PluginProvider
1486512686107    addons.manager    DEBUG    Registering shutdown blocker for PluginProvider
1486512686108    addons.manager    DEBUG    Provider finished startup: PluginProvider
1486512686108    addons.manager    DEBUG    Completed startup sequence
[GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0
Crash Annotation GraphicsCriticalError: |[0][GFX1]: D3D11 device creation failed: 0x887a0004 (t=5.35032) [GFX1]: D3D11 device creation failed: 0x887a0004
1486512687791    addons.manager    DEBUG    Starting provider: <unnamed-provider>
1486512687791    addons.manager    DEBUG    Registering shutdown blocker for <unnamed-provider>
1486512687792    addons.manager    DEBUG    Provider finished startup: <unnamed-provider>
1486512688069    DeferredSave.extensions.json    DEBUG    Write succeeded
1486512688069    addons.xpi-utils    DEBUG    XPI Database saved, setting schema version preference to 19
1486512688069    DeferredSave.extensions.json    DEBUG    Starting timer
1486512688092    DeferredSave.extensions.json    DEBUG    Starting write
1486512689179    addons.repository    DEBUG    No addons.json found.
1486512689180    DeferredSave.addons.json    DEBUG    Save changes
1486512689185    DeferredSave.addons.json    DEBUG    Starting timer
1486512689237    addons.manager    DEBUG    Starting provider: PreviousExperimentProvider
1486512689237    addons.manager    DEBUG    Registering shutdown blocker for PreviousExperimentProvider
1486512689237    addons.manager    DEBUG    Provider finished startup: PreviousExperimentProvider
1486512689258    DeferredSave.addons.json    DEBUG    Starting write
Crash Annotation GraphicsCriticalError: |[C0][GFX1]: Potential driver ver1486512689295    DeferredSave.extensions.json    DEBUG    Write succeeded
1486512689348    DeferredSave.addons.json    DEBUG    Write succeeded
sion mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0 (t=3.54847) [GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    ... 7 more
2 respostas
solução!

Oi Carlos, como está ?

Para o Firefox mais atualizado, está versão do selenium não rola. Você vai precisar utilizar a versão mais recente, que você poderá baixar aqui :

http://www.seleniumhq.org/download/

Além disso você terá que baixar um driver, chamado Gecko Driver, que serve para ele executar o Selenium nas versões mais recentes, isso para o Firefox.

https://github.com/mozilla/geckodriver/releases

Para configurar esse driver é bem simples, antes de cada teste, no @BeforeClass você vai precisar invocar o seguinte código :

System.setProperty("webdriver.gecko.driver", caminhoAtéDriver); // tem que ser o caminhi completo C://

Depois de fazer isso, seu código deve rolar.

Abraços

Olá Matheus, vou bem.

Obrigado pela ajuda com ela consegui agora usar o Selenium, tive que atualizar minha JRE também mas agora esta rodando. Valeu.