appium / WebDriverAgent

A WebDriver server for iOS and tvOS
Other
1.23k stars 384 forks source link

WDA won't start up. #945

Open merofunk opened 1 month ago

merofunk commented 1 month ago

iPhone 17.5 MacOS 14.5 Appium 2.11.5 XCUITest 7.27 XCode 16

I've been dealing with this problem for a couple of days, the most standard configuration is done in WebDriverAgent(XCode), I make a build of WDARunner, after making a test of the same TARGET, it installs me WDA on the iPhone, starts it (the screen fades and there is an inscription that it is automation and how it can be turned off). As soon as I turn off this test or reboot the phone, of course WDA is disabled, and when trying to run it manually again, nothing works, it just opens for a second and closes immediately, to run it again you need to run the test again from the XCode application.

I tried IDB, when I tried to use capabilities related to WDA startup, it wrote that it didn't find it.

And no, I don't want to run the test and WDA through XCode every time. Thank you all in advance, please help me. I did everything I saw, cleared data, checked certificates, reinstalled and more.

KazuCocoa commented 1 month ago

I guess you'd like to do https://appium.github.io/appium-xcuitest-driver/latest/guides/run-preinstalled-wda/#additional-requirement-for-ios-17tvos17 Asking questions in https://discuss.appium.io/ would also help.

Also, if you tried something via Appium, please attach the full Appium log

merofunk commented 1 month ago

@KazuCocoa https://pastebin.com/8GQQ7ZxY - Appium Logs, try run Inspector.

And regarding your post above, I've tried them already. I've seen about Framework, I've tried running it and uninstalling it. But the most important commands from them do not run, because of the absence of such a file or subcommand. Here is the proof of the word https://pastebin.com/myPkj6qr

More information will be given by what I used and the appium:usePreinstalledWDA setting, when running from the console and from the inspector. It is the same everywhere, it opens the WebDriverAgentRunner-Runner application and closes it immediately. And even if I use the command devicectl device process launch --device 00008020-000E4080368A002E --terminate-existing --environment-variables '{“USE_PORT”: “54377”, “WDA_PRODUCT_BUNDLE_IDENTIFIER”: “com. aui.WebDriverAgentRunner.xctrunner”, ‘MJPEG_SERVER_PORT’: ‘54378’}' com.aui.WebDriverAgentRunner.xctrunner

It says it has run, but it just opens the application and closes it immediately.

KazuCocoa commented 1 month ago

As the link I attached, didn't your installed WDA have Frameworks/XC**? WDA which has the Frameworks/XC* files fail to start as reference errors.

To launch the WebDriverAgentRunner package with xcrun devicectl device process launch for real devices it should not have Frameworks/XC** files.

Your attached link ended with:

[0170529d][XCUITestDriver@96ea] Executing xcrun devicectl device process launch --device 00008020-000E4080368A002E --terminate-existing --environment-variables '{"USE_PORT":"8100","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.aui.WebDriverAgentRunner.xctrunner"}' com.aui.WebDriverAgentRunner.xctrunner
[0170529d][WD Proxy] Matched '/status' to command name 'getStatus'
[0170529d][WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[0170529d][iProxy@00008020:8100] Connection was refused to port 8100

Did you end the session then? or the link missed contents?

The device's system log would help to see the error message why it failed to start WDA.

merofunk commented 1 month ago

https://pastebin.com/W7BeBcr5 Unfortunately the whole part of the log didn't fit. But I always get this error when I run this command. And the most nonsense is that when I build and test it all through XCode, it runs everything without errors, but here it writes that there is no certificate, although it runs normally through XCode.

I've cleared the XC*

KazuCocoa commented 1 month ago

Did you use a free account with xcodebuild? I had experienced a free account was not able to sign with xcodebuild CLI while worked with Xcode before. Very old era worked both though, so I guessed Apple added some restrictions. It could differ from tools version etc. I don't have accurate insights as it could be environment dependent things. (We put one obvious diff between a paid account and a free in https://appium.github.io/appium-xcuitest-driver/latest/preparation/prov-profile-generic-manual/ , but it has more hidden things I guess.)

I've cleared the XC*

Then, please share the device log when you launch the app on a real device. It may have a reason why the app launch failed.

merofunk commented 1 month ago

Yeah, that's what I use.

merofunk commented 1 month ago

Then, please share the device log when you launch the app on a real device. It may have a reason why the app launch failed.

What kind of app is it exactly? WDARunner? And where can I find logs with this action?

merofunk commented 1 month ago

Then, please share the device log when you launch the app on a real device. It may have a reason why the app launch failed.

https://pastebin.com/xPbnrEkm Ran the command from your link, for ios

KazuCocoa commented 1 month ago

The device log is the device's system log that usually can get via console.app on the host machine, or appium:showIOSLog https://appium.github.io/appium-xcuitest-driver/latest/reference/capabilities/ in appium capabilities (then, the appium server log could be huge,) or 3rd party tools addressed in https://appium.github.io/appium-xcuitest-driver/latest/guides/wda-custom-server/#wda-startup-via-code for example.