appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.22k stars 760 forks source link

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure #2144

Open ANSHUL786 opened 8 months ago

ANSHUL786 commented 8 months ago

Do I have the most recent component updates?

Is the component officially supported by the Appium team?

Is there an existing issue for this?

Current Behavior

when i am trying to run my appium code getting below error

FAILED CONFIGURATION: @BeforeClass UAApp.BaseComponent.AndroidBaseTest.configureAppium org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Yesterday it is working fine.

Expected Behavior

it should start execution.

Minimal Reproducible Example

@Test public void startTest(){ DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("deviceName", "oneplus7"); caps.setCapability("platformVersion", "12"); caps.setCapability("ignoreHiddenApiPolicyError" , true); caps.setCapability("app", System.getProperty("user.dir") + "/src/test/java/resources/UA_QA_APP.apk"); caps.setCapability("automationName", "UiAutomator2"); driver = new AndroidDriver(new URI("http://127.0.0.1:4723").toURL(), caps); }

Environment

Link to Appium Logs

No response

Further Information

No response

KazuCocoa commented 8 months ago

Please attach the full appium server log

ANSHUL786 commented 8 months ago

Today i am not able to start the server via my code

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Host info: host: 's-ASUS-A23', ip: '192.168.1.6' at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:536) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:268) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:161) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:90) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:102) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:109)

simonberner commented 8 months ago

Hi @ANSHUL786 I just had the same issue on my side and solved it by updating the appium java-client from v9.2.0 to v9.2.1. 🙂

sanjaneya-chwy commented 8 months ago

@simonberner -- The latest version of java client is 9.2.0...where did you get 9.2.1 from?

sanjaneya-chwy commented 8 months ago

I am seeing the exact same issue as well. Updated Appium to 2.5.1 and also updated Java client to 9.2.0. Any help in fixing this issue is greatly appreciated

sanjaneya-chwy commented 8 months ago

UPDATE: appium java-client from v9.2.0 to v9.2.1 did the trick. But I am still puzzled about how do we know to use 9.2.1 when maven website only shows 9.2.0 as latest: https://mvnrepository.com/artifact/io.appium/java-client

valfirst commented 8 months ago

@sanjaneya-chwy https://repo1.maven.org/maven2/io/appium/java-client/

Jiyvn commented 8 months ago

hit the same error with 9.2.0 using selenium 4.19. After explicitly specifying the selenium version to 4.18.1, this issue get fixed. Maybe selenium 4.19 changes causing the problem? https://github.com/SeleniumHQ/selenium/blob/acd9d0e77dc5a5a39c3a95a5aa0e94a6c4161fe7/java/CHANGELOG#L1 @KazuCocoa

valfirst commented 8 months ago

@Jiyvn https://github.com/appium/java-client?tab=readme-ov-file#compatibility-matrix

simonberner commented 8 months ago

@simonberner -- The latest version of java client is 9.2.0...where did you get 9.2.1 from?

@sanjaneya-chwy see https://github.com/appium/java-client/releases

JialiLyv commented 7 months ago

I am still having this issue using java-client 9.2.2 and selenium-java 4.19.0.

And I am sure my Appium Server is working as I can connect to it using Appium Inspector using the same capabilities.

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 404. Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource Build info: version: '4.19.1', revision: 'abe0ee07dc' System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.4.1', java.version: '18.0.2' Driver info: io.appium.java_client.android.AndroidDriver

JialiLyv commented 7 months ago

an update on this, it turned out the cache was the culprit. after changing to the above combination and reloading the mavin project fixed the issue.

NehallBaig commented 2 months ago

@ANSHUL786 Please use mentioned below dependencies. I hope your error will be resolved.

io.appium java-client 9.2.2 org.seleniumhq.selenium selenium-remote-driver 4.13.0
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-support</artifactId>
    <version>4.12.0</version>
</dependency>