Skip to content

WDA v14.1.1 Has issues with MJPEG screenshots - SessionNotCreatedException #1157

Open

Description

@tking16

I'm using pytest-html to report on my test runs. For the iOS tests particularly I'm getting failures since upgrading my xcuitest and Appium. These failures aren't generating screenshots for my tests either:

 raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Could not start a new session. Error while creating session with the service http://localhost:4726. Could not start a new session. Response code 500. Message: Waited 10000ms but the MJPEG server never sent any images 
E       Host info: host: 'XD99WFXHKN', ip: '10.63.15.144'
E       Build info: version: '4.38.0', revision: '6b412e825c'
E       System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.2', java.version: '17.0.19'
E       Driver info: driver.version: unknown
E       Build info: version: '4.38.0', revision: '6b412e825c'
E       System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.2', java.version: '17.0.19'
E       Driver info: driver.version: unknown
E       Build info: version: '4.38.0', revision: '6b412e825c'
E       System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.4.1', java.version: '17.0.17'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.remote.RemoteNode.newSession (RemoteNode.java:167)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:427)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:346)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:601)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:551)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
E           at java.lang.Thread.run (Thread.java:840)

_env/lib/python3.14/site-packages/selenium/webdriver/remote/errorhandler.py:232: SessionNotCreatedException

Appium Server Log Snippet

Activity

  1. KazuCocoa commented on Jun 18, 2026

    @KazuCocoa
    Member

    It looks like the environment failed to take a screenshot, as there was no response from the underlying XCTest API.

    �[38;5;131m[a18df869]�[0m�[38;5;101m[XCUITestDriver@3137]�[0m Starting MJPEG stream reading URL: 'http://localhost:9101'
    �[38;5;131m[a18df869]�[0m�[38;5;173m[Xcode]�[0m 2026-06-17 09:26:42.079842+0100 WebDriverAgentRunner-Runner[86991:138061831] Error Domain=com.facebook.WebDriverAgent Code=1 "Cannot take a screenshot within 20000 ms timeout" UserInfo={NSLocalizedDescription=Cannot take a screenshot within 20000 ms timeout}
    �[38;5;131m[a18df869]�[0m�[38;5;173m[Xcode]�[0m 2026-06-17 09:26:43.192752+0100 WebDriverAgentRunner-Runner[86991:138061831] Error Domain=com.facebook.WebDriverAgent Code=1 "Cannot take a screenshot within 20000 ms timeout" UserInfo={NSLocalizedDescription=Cannot take a screenshot within 20000 ms timeout}
    �[38;5;131m[a18df869]�[0m�[38;5;85m[Support]�[0m Error getting MJpeg screenshot chunk: aborted
    �[38;5;131m[a18df869]�[0m�[38;5;85m[Support]�[0m The connection to MJPEG server at http://localhost:9101 has been closed
    

    [proxy _XCT_requestScreenshot:screnshotRequest
    withReply:^(id image, NSError *err) {
    if (nil != err) {
    innerError = err;
    } else {
    screenshotData = [image data];
    }
    dispatch_semaphore_signal(sem);
    }];
    int64_t timeoutNs = (int64_t)(timeout * NSEC_PER_SEC);
    if (0 != dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, timeoutNs))) {
    NSString *timeoutMsg = [NSString stringWithFormat:@"Cannot take a screenshot within %@ timeout", formatTimeInterval(SCREENSHOT_TIMEOUT)];
    if (nil == error) {
    [FBLogger log:timeoutMsg];
    } else if (nil == innerError) {
    [[[FBErrorBuilder builder]
    withDescription:timeoutMsg]
    buildError:error];
    }
    }
    if (nil != error && nil != innerError) {
    *error = innerError;
    }

    What was printed in the device log?

    Also, what version was working? The latest version's changes were log messages/docstring #1154

  2. locked and limited conversation to collaborators on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions