skip to Main Content

I am currently trying to run tests using Appium on a real iOS device, with the pytest and selenium framework. Before running tests, I successfully built the WebDriverAgent onto the device and started the Appium server. After entering the pytest command to start the test the Safari browser in the iOS device opens but the test does not start. I get this error in the Appium logs:

[debug] [iProxy@67f2ea78:8100] Closing the connection
[debug] [DevCon Factory] Cached connections count: 0
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [XCUITest] Found a remote debugger session. Removing...
[debug] [RemoteDebugger] Cleaning up listeners
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1639089800521 (14:43:20 GMT-0800 (Pacific Standard Time))
[debug] [W3C] Encountered internal error running command: Error: Could not navigate to webview! Err: Failed to receive any data within the timeout: 5000
[debug] [W3C]     at spinHandles (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-ios-driver/lib/commands/context.js:522:23)
[debug] [W3C]     at XCUITestDriver.navToViewWithTitle (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-ios-driver/lib/commands/context.js:564:3)
[debug] [W3C]     at XCUITestDriver.navToInitialWebview (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/context.js:29:5)
[debug] [W3C]     at XCUITestDriver.start (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:479:7)
[debug] [W3C]     at XCUITestDriver.createSession (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:215:7)
[debug] [W3C]     at AppiumDriver.createSession (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/lib/appium.js:371:35)
[debug] [W3C] Caused by: Error: Failed to receive any data within the timeout: 5000
[debug] [W3C]     at Timeout._onTimeout (/Users/user/.nvm/versions/node/v17.0.1/lib/node_modules/appium/node_modules/appium-ios-device/lib/plist-service/index.js:67:16)
[debug] [W3C]     at listOnTimeout (node:internal/timers:557:17)
[debug] [W3C]     at processTimers (node:internal/timers:500:7)
[HTTP] <-- POST /wd/hub/session 500 14924 ms - 741
[HTTP] 
[iProxy@67f2ea78:8100] The connection has been closed

Has anyone come across this issue and found a resolution?

capabilities = {
"platformName": settings.MOBILE_DEVICE_PLATFORM,
"platformVersion": _platform_version,
"newCommandTimeout": 3000,
"udid": _device_id,
"automationName" = "XCUITest",
"browserName" = "Safari",
"usePrebuiltWDA": True,
"deviceName": "iPhone
}

Appium version: 1.22.1

XCode version: 13.1 (13A1030d)

iOS version on device: 15.1

Node version: 17.0.1

NVM version: 0.39.0

4

Answers


  1. Chosen as BEST ANSWER

    Not sure why or how but my issue was fixed by using Appium Desktop instead.


  2. It’s causing because of IOSDriver when we access programatically. Android works fine.

    org.openqa.selenium.SessionNotCreatedException: Unable to create a new
    remote session. Please check the server log for more details. Original
    error: An unknown server-side error occurred while processing the
    command. Original error: Failed to receive any data within the
    timeout: 5000

    Failed exactly here.

    driver = new IOSDriver<>(new URL(remoteUrl.toString()),
    desiredCapabilities);

    AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
        serviceBuilder.usingAnyFreePort();
        serviceBuilder.usingDriverExecutable(new File(Appium_Node_Path));
        serviceBuilder.withAppiumJS(new File(Appium_JS_Path));
        HashMap<String, String> environment = new HashMap<String,String>();
        environment.put("PATH", "/usr/local/bin:" + System.getenv("PATH"));
        serviceBuilder.withEnvironment(environment);
        server = AppiumDriverLocalService.buildService(serviceBuilder);
        server.start();
        server.isRunning();
    driver = new IOSDriver<>(new URL(remoteUrl.toString()), desiredCapabilities);
    

    Mac OS version 12.2.1 Xcode version 13.2.1 Appium 1.22.2

    No issue with WDA if directly run Appium desktop server works fine.

     URL remoteUrl = new URL("http://0.0.0.0:4723/wd/hub");
        driver = new IOSDriver<>(remoteUrl, desiredCapabilities);
    
    Login or Signup to reply.
  3. I faced same problem with Appium 1.22.3.
    Node version is root cause of this error. I was using node v18 when I changed it to v16 it worked as expected.

    Login or Signup to reply.
  4. Like @positivecrux I faced same problem with Appium 1.22.3. I was using node v18 when I updated to v16.9.1 it worked as expected.

    npm install -g n
    sudo n stable
    node -v
    

    or for 2nd line if you get issue you can use specific version

    sudo n 16.9.1
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search