appium / appium/java-client

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

Open
#1,941 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

Hi everyone,
i'm getting 'SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: 'localhost', ip: '127.0.0.1' cuando quiero conectarme al servidor de appium local desde android studio(kotlin).

Environment

Below is my Environment:
Mac OS: Ventura 13.4
Android Studio: 2022.1.1
Appium.io : 8.5.1
Appium server: 2.0.0-beta.71
node: v20.3.0
device: Android Samsung A235M

Code To Reproduce Issue

`@get:Rule
val activityScenarioRule = ActivityScenarioRule(LaunchActivity::class.java)

private lateinit var driver: AndroidDriver

@Before
@Throws(MalformedURLException::class)
fun setUp() {
    val desiredCapabilities = DesiredCapabilities()
    desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "samsung SM-A235M")
    desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "13")
    desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "android")
    desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "appium")
    //desiredCapabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome")
    val remoteUrl = URL("http://127.0.0.1:4723")
    driver = AndroidDriver(remoteUrl, desiredCapabilities)
}

@After
fun tearDown() {
    driver?.quit()
}

@Test
fun testButtonNavigationToBrowser() {
    onView(withId(R.id.single_single_on_btn)).perform(click())

    Thread.sleep(7000)
    
    val inputField = driver?.let {
        it.findElement(By.cssSelector("input[name='domain']"))
    }
    
    inputField?.let { it.sendKeys("fulcrum") }
}`

Link To Appium Logs

'
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: 'localhost', ip: '127.0.0.1'
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:274)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:89)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:101)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:113)
at com.spatialnetworks.fulcrum.app.LoginDomainTest.setUp(LoginDomainTest.kt:38)
... 33 trimmed
Caused by: org.openqa.selenium.WebDriverException: Connection refused
Build info: version: '4.9.1', revision: 'eb2032df7f'
System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '4.19.157-perf-25521380-abA235MUBU1BVL1', java.version: '0'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.lambda$execute$4(AppiumCommandExecutor.java:262)
at io.appium.java_client.remote.AppiumCommandExecutor$$ExternalSyntheticLambda3.get(Unknown Source:2)
at java.util.Optional.orElseGet(Optional.java:365)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:261)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
... 40 more
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:762)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:1012)'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer in LoginDomainTest.kt at line 38 and the Appium client, server, Node, Android Studio, and device versions listed. Examine the configured remote URL alongside the connection-refused stack trace and local Appium server setup. Done means identifying a reproducible client or setup defect and documenting the verified cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.