12
respostas

O esquema de URI corresponde a um manipulador de protocolo desconhecido

Após tentar rodar o localhost no Firefox, o JUNIT exibiu o seguinte erro:

org.openqa.selenium.WebDriverException: [Exception... "The URI scheme corresponds to an unknown protocol handler" nsresult: "0x804b0012 (NS_ERROR_UNKNOWN_PROTOCOL)" location: "JS frame :: chrome://marionette/content/listener.js :: get/< :: line 1051" data: no] Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z' System info: host: 'DESKTOP-8TD7D8B', ip: '192.168.0.13', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_172' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 61.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 9312, moz:profile: C:\Users\alexb\AppData\Loca..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 10.0, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}

12 respostas

Continuação:

Session ID: 3713543f-a6ca-429e-8c38-9fdd0bcc8958 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276) at br.com.abrs.teste.UsuariosPage.visita(UsuariosPage.java:15) at br.com.abrs.teste.TesteSistemaUsuarios.adicionarUsuarioNoSistema(TesteSistemaUsuarios.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.util.Iterator.forEachRemaining(Unknown Source) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.forEach(Unknown Source) at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:83) at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:74) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90) at org.eclipse.jdt.internal.junit5.runner.JUnit5TestRe

Oi Alex,

Pode postar aqui o seu código completo, para entendermos melhor o que pode estar acontecendo?

public class TesteSistemaUsuarios {

    // instaciando a classe WebDriver
    private FirefoxDriver driver;

    @Before
    public void inicializaBrowser() {
        System.setProperty("webdriver.gecko.driver", "C:/geckodriver-v0.21.0-win64/geckodriver.exe"); 
        this.driver = new FirefoxDriver();
        }

    @Test    
    public void adicionarUsuarioNoSistema() {
        UsuariosPage usuarios = new UsuariosPage (driver);
        usuarios.visita();
        usuarios.novo().cadastra("Ronaldo Luiz de Albuquerque", "ronaldo2009@terra.com.br");
        assertTrue(usuarios.existeNaListagem("Ronaldo Luiz de Albuquerque", "ronaldo2009@terra.com.br"));
            }
public class UsuariosPage {

    private WebDriver driver;

    public UsuariosPage(WebDriver driver) {
        this.driver = driver;
    }

    public void visita() {
        driver.get("localhost:8080/usuarios");
    }

    public NovoUsuarioPage novo() {
        // clica no link de novo usuario
        driver.findElement(By.linkText("Novo Usuário")).click();
        // retorna a classe que representa a nova pagina
        return new NovoUsuarioPage(driver);
    }

     public boolean existeNaListagem(String nome, String email) {
            // verifica se os elementos existem na listagem
            return driver.getPageSource().contains(nome) && 
                    driver.getPageSource().contains(email);
        }

}
public class NovoUsuarioPage {

    private WebDriver driver;

    public NovoUsuarioPage(WebDriver driver) {
        this.driver = driver;
    }

    public void cadastra(String nome, String email) {
        WebElement txtNome = driver.findElement(By.name("usuario.nome"));
        WebElement txtEmail = driver.findElement(By.name("usuario.email"));

        txtNome.sendKeys(nome);
        txtEmail.sendKeys(email);

        txtNome.submit();
    }
}

Oi Alex,

Não vi problemas no seu código.

Talvez possa ser o caminho do driver:

System.setProperty("webdriver.gecko.driver", "C:/geckodriver-v0.21.0-win64/geckodriver.exe");

Teste alterando para esse formato:

System.setProperty("webdriver.gecko.driver", "C:\\geckodriver-v0.21.0-win64\\geckodriver.exe");

E veja se resolve.

Não funcionou. Exibe o mesmo erro.

Mensagem do Console:

1532130490364    geckodriver    INFO    geckodriver 0.21.0
1532130490379    geckodriver    INFO    Listening on 127.0.0.1:38200
1532130490996    mozrunner::runner    INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\alexb\\AppData\\Local\\Temp\\rust_mozprofile.5xiNvxcBD53p"
Unable to read VR Path Registry from C:\Users\alexb\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\alexb\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\alexb\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\alexb\AppData\Local\openvr\openvrpaths.vrpath
Unable to read VR Path Registry from C:\Users\alexb\AppData\Local\openvr\openvrpaths.vrpath
1532130496289    Marionette    INFO    Listening on port 63424
1532130496549    Marionette    WARN    TLS certificate errors will be ignored for this session
jul 20, 2018 8:48:16 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMAÇÕES: Detected dialect: W3C
JavaScript error: chrome://browser/content/content.js, line 670: TypeError: docShell.failedChannel is null
1532130497555    addons.xpi    WARN    Exception running bootstrap method shutdown on activity-stream@mozilla.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource://activity-stream/lib/TelemetryFeed.jsm :: uninit :: line 493"  data: no] Stack trace: uninit()@resource://activity-stream/lib/TelemetryFeed.jsm:493
onAction()@resource://activity-stream/lib/TelemetryFeed.jsm:451
_middleware/</<()@resource://activity-stream/lib/Store.jsm:51
Store/this[method]()@resource://activity-stream/lib/Store.jsm:29
uninit()@resource://activity-stream/lib/Store.jsm:170
uninit()@resource://activity-stream/lib/ActivityStream.jsm:318
uninit()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///C:/Program%20Files/Mozilla%20Firefox/browser/features/activity-stream@mozilla.org.xpi!/bootstrap.js:79
shutdown()@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///C:/Program%20Files/Mozilla%20Firefox/browser/features/activity-stream@mozilla.org.xpi!/bootstrap.js:187
callBootstrapMethod()@resource://gre/modules/addons/XPIProvider.jsm:2757
observe()@resource://gre/modules/addons/XPIProvider.jsm:1672
GeckoDriver.prototype.quit()@driver.js:3282
despatch()@server.js:294
execute()@server.js:268
onPacket/<()@server.js:243
onPacket()@server.js:242
_onJSONObjectReady/<()@transport.js:500
JavaScript error: resource:///modules/SavantShieldStudy.jsm, line 171: TypeError: this.addonListener is undefined
[Child 780, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 780, Chrome_ChilJavaScript error: resource://gre/modules/JSONFile.jsm, line 159: Error: Data is not ready.

###!!! [Parent][DispatchAsyncMessage] Error: PBackgroundIDBFactory::Msg_PBackgroundIDBFactoryRequestConstructor Value error: message was deserialized, but contained an illegal value


###!!! [Parent][DispatchAsyncMessage] Error: PBackgroundIDBFactory::Msg_PBackgroundIDBFactoryRequestConstructor Value error: message was deserialized, but contained an illegal value

*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping
[GPU 10440, Chrome_ChildThread] W

Alex,

Pelo log de erro, o problema aconteceu aqui:

br.com.abrs.teste.UsuariosPage.visita(UsuariosPage.java:15) at

No seu método visita:

public void visita() {
    driver.get("localhost:8080/usuarios");
}

Pode ser então porque faltou o protocolo http no endereço.

Altere para:

public void visita() {
    driver.get("http://localhost:8080/usuarios");
}

E veja se resolve.

Alterei e agora exibe o seguinte erro:

org.openqa.selenium.WebDriverException: Reached error page: about:neterror?e=connectionFailure&u=https%3A//localhost%3A8080/usuarios&c=UTF-8&f=regular&d=O%20Firefox%20n%C3%A3o%20conseguiu%20estabelecer%20uma%20conex%C3%A3o%20com%20o%20servidor%20localhost%3A8080.
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'DESKTOP-8TD7D8B', ip: '192.168.0.13', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_172'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 61.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 12076, moz:profile:
Continua...

C:\Users\alexb\AppData\Loca..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 10.0, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: 50538cfc-9548-47ed-b496-e098b83cee75
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
    at br.com.abrs.teste.UsuariosPage.visita(UsuariosPage.java:15)
    at br.com.abrs.teste.TesteSistemaUsuarios.adicionarUsuarioNoSistema(TesteSistemaUsuarios.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Iterator.forEachRemaining(Unknown Source)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.forEach(Unknown Source)
    at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:83)
    at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:74)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
    at at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

Oi Alex,

Agora não foi erro de problemas com código ou configurações, mas erro ao acessar o endereço http://localhost:8080/usuarios.

Verifique se esse endereço está correto e se a aplicação desse endereço está rodando normalmente.

Uma maneira de ver isso é tentar acessar manualmente esse endereço pelo browser no seu computador.