1
resposta

Erro ao executar o projeto

Mesmo depois de todo o processo de instalação ok e verificação com appium-doctor ao tentar executar o código tomei um erro. Detalhe estou usando o linux: Ubuntu 20.04 e o Gradle ao invés do Maven.

Link repositorio do Github

> Task :App.main()
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:225)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:151)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:79)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:87)
    at alura.automacao.app.App.main(App.java:26)
Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: /. Last 48 characters read: {
  "desiredCapabilities": {
    "appium:app": /
Caused by: org.openqa.selenium.json.JsonException: Unable to determine type from: /. Last 48 characters read: {

Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'NI-INV2914', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.13.0-40-generic', java.version: '17.0.3'
Driver info: driver.version: AppiumDriver
    at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:126)
    at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:141)
    at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
    at org.openqa.selenium.json.MapCoercer.lambda$apply$0(MapCoercer.java:68)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at org.openqa.selenium.json.MapCoercer.lambda$apply$1(MapCoercer.java:72)
    at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
    at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
    at org.openqa.selenium.json.JsonInput.read(JsonInput.java:296)
    at org.openqa.selenium.remote.NewSessionPayload.getOss(NewSessionPayload.java:308)
    at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:97)
    at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:72)
    at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:67)
    at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:101)
    at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:146)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:180)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    ... 5 more

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

EDIT:

Encontrei o problema, e a passagem do apk como File ele usa um get absolutePath()

1 resposta

Olá Horácio, como vai?

Ahh que bacana que você conseguiu solucionar o problema e contou aqui no fórum como resolveu, além de contribuir com a comunidade aqui no fórum, isso vai ajudar demais outras alunas e alunos que possam ter a mesma dúvida.

Bons estudos por aí =)