.getPageSource() leads to unrecognized selector sent to instance 0x3022b8d80

Hello there,

I’ve a problem of executing Selenium + Java + Appium tests on the iOS system.

Environment:
Appium: 2.11.3
Appium inspector: 2024.8.2
Java: 17.0.7 (LTS)
Device: iPhone 14
device system: iOS 18.0 (issue was active on 17.6.1 also)
laptop system: macOS 15.0 Sequoia (issue was active on 14.6 Sonoma also)
Xcode version: 16.0

Capabilities:

{
  appium:app: "/path/to/app",
  appium:autoAcceptAlerts: true, 
  appium:automationName: XCuiTest, 
  appium:bundleId: io.***.***, 
  appium:databaseEnabled: false, 
  appium:deviceName: iPhone 14, 
  appium:eventTimings: true, 
  appium:javascriptEnabled: true, 
  appium:locationContextEnabled: false, 
  appium:maxTypingFrequency: 10, 
  appium:networkConnectionEnabled: false, 
  appium:platformVersion: 18, 
  appium:processArguments: {args: [dev]}, 
  appium:takesScreenshot: true, 
  appium:udid: ************, 
  appium:updatedWDABundleId: io.appium.WebDriverAgentRunner, 
  appium:useNewWDA: true, 
  appium:webStorageEnabled: false, 
  appium:xcodeOrgId: ******, 
  appium:xcodeSigningId: iPhone Developer, 
  platformName: IOS
}

I’ve tried to add next capabilities, but without help:

{
  appium:waitForQuiescence: "false" or "true",
  appium:waitForIdleTimeout: "10000" //ms  
}

When I run test via Maven:

mvn clean test -Dtest=TestClass#testScenario -Denv=ios

it leads to:

AccHolderLoginTest>BaseTest.logoutUser:241 » WebDriver An unknown server-side error occurred while processing the command. Original error: -[XCUIApplicationProcess waitForQuiescenceIncludingAnimationsIdle:]: unrecognized selector sent to instance 0x3022b8d80
Build info: version: '4.24.0', revision: '748ffc9bc3'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '15.0', java.version: '17.0.7'
Driver info: io.appium.java_client.ios.IOSDriver
Command: [944b0e29-e4d3-4b37-bc84-6f1d81f4ae40, getPageSource {}]

The problem is in .getPageSource() which is used on some places in our code.

When I comment-out .getPageSource() from the code, test executes without any problems.

Putting out .getPageSource() from the code couldn’t be an solution, because I get same error when I want to inspect our app using Appium Inspector. Because Appium Inspector also calls .getPageSource() in background:

[944b0e29][XCUITestDriver@2864] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: -[XCUIApplicationProcess waitForQuiescenceIncludingAnimationsIdle:]: unrecognized selector sent to instance 0x30222d880
    at errorFromW3CJsonCode (/Users/dusan.panic/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:1112:25)
    at ProxyRequestError.getActualError (/Users/dusan.panic/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:981:14)
    at JWProxy.command (/Users/dusan.panic/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:353:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at XCUITestDriver.proxyCommand (/Users/dusan.panic/.appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:112:35)
    at XCUITestDriver.getNativePageSource (/Users/dusan.panic/.appium/node_modules/appium-xcuitest-driver/lib/commands/source.js:32:7)
    at XCUITestDriver.getPageSource (/Users/dusan.panic/.appium/node_modules/appium-xcuitest-driver/lib/commands/source.js:22:12)
[944b0e29][HTTP] <-- GET /session/944b0e29-e4d3-4b37-bc84-6f1d81f4ae40/source 500 21 ms - 1445 
[944b0e29][HTTP] --> POST /session/944b0e29-e4d3-4b37-bc84-6f1d81f4ae40/timeouts {"implicit":1000}

As workaround you may try disable animation on phone …

Hey, I faced the same issue. You might want to try updating the XCUITest driver. You can try this version 7.26.4.

My setup is almost similar to yours. Below is my environment:
Appium: 2.11.4
XCUITest: 7.26.4
Device iPhone 14 Plus
Xcode Version: 16.0
OS Version: iOS 18

Thanks Aleksei, but this won’t help. :face_with_diagonal_mouth:

Thank you very much! I totally forgot that XCUITest driver has to be updated separately.
Updating it to 7.26.4 version solved the problem of executing our tests.

Unfortunately, I still get same error message when I want to run application via Appium Inspector. I’ve reinstalled Appium Inspector again, but it didn’t help.

1 Like

You are welcome.

Regarding the .getPageSource() issue. Maybe update the appium version to 2.11.4. I don’t know if that might help, worth trying.

Already done that, didn’t help…

Update:
Problem solution is here:

I updated “xcuitest” to version 7.26.4 and the problem was resolved

1 Like

Hello there, I’ve resolved this issue for my case.

So, after updating:

  • Appium to 2.11.4
  • Appium inspector to 2024.8.2
  • XCUITest driver to 7.26.4

Only problem fixed was that I could execute automation test scripts on iPhone real device, but I couldn’t start the Appium Inspector on the device. Automation by Appium Inspector were started on the iPhone, but on the laptop Appium Inspector was just loading and displaying nothing.

Additional solution was adding two new capabilities into Appium Inspector configuration:

// App capability is required, not to use already installed app from the device
"apium:app": "/app/absolute/path",
"appium:useNewWDA": false,
"appium:usePrebuiltWDA": true

Note: New WebDriverAgentRunner has to be already installed on the device. We are using WebDriverAgentRunner created as empty app by xCode.