Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating session is too slow #623

Open
tburakdemir opened this issue Oct 18, 2022 · 17 comments
Open

Creating session is too slow #623

tburakdemir opened this issue Oct 18, 2022 · 17 comments
Labels

Comments

@tburakdemir
Copy link

Hello everyone,
I am starting the webdriveragent with xcodebuild like that:

xcodebuild -allowProvisioningUpdates -project /projects/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination platform="iOS,id=0000000-0010000000E" test

It gives server url normally. Logs:
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2022-10-18 16:37:27.075
t = 0.00s Set Up
2022-10-18 16:37:27.077387+0300 WebDriverAgentRunner-Runner[88623:5742668] Built at Sep 13 2022 13:18:10
2022-10-18 16:37:27.089916+0300 WebDriverAgentRunner-Runner[88623:5742668] ServerURLHere->http://169.254.21.XXX:8100<-ServerURLHere
2022-10-18 16:37:27.090508+0300 WebDriverAgentRunner-Runner[88623:5742851] Using singleton test manager
2022-10-18 16:38:37.773636+0300 WebDriverAgentRunner-Runner[88623:5742668] Getting the most recent active application (out of 1 total items)

When I try to create session with postman
http://169.254.21.xxx:8100/session
BODY {
"capabilities": {}
}

It logs this.
t = 70.72s Find the Application 'com.apple.springboard'

Then 60 sec later logs this
t = 130.74s Requesting snapshot of accessibility hierarchy for app with pid 62

then I can get sessionId. Why does it take 60 sec after this "Find the application" log.
This 60 sec waiting always happens in first try. After first try it works normally. But when i termiate xcodebuild process and start again. This issue start again.

Try to some cap. in appium readme some combianations or one by one. But i think they are not working on here
http://169.254.21.xxx:8100/session
BODY {
"capabilities": {
"bundleId": "com.apple.Preferences",
"wdaLaunchTimeout": 10000,
"newCommandTimeout": 10000,
"commandTimeouts": "10000",
"shouldUseSingletonTestManager": false,
"waitForIdleTimeout": 0,
"wdaEventloopIdleDelay": 3
"waitForQuiescence": false

   }

}

Here is the full logs of other attempt. It is same, try it hundred times.

`xcodebuild -allowProvisioningUpdates -project /Users/xxxxxx/projects/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination platform="iOS,id=00008020-001974xxxxx" test
2022-10-18 16:52:09.595 xcodebuild[17768:262218] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-10-18 16:52:09.595 xcodebuild[17768:262218] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
Command line invocation:
/Applications/Xcode-13.4.app/Contents/Developer/usr/bin/xcodebuild -allowProvisioningUpdates -project /Users/xxxxxx/projects/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination platform=iOS,id=00008020-00197451223A002E test

User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: be392f989b1227654646cf53b2b0be32
Build description path: /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/XCBuildData/be392f989b1227654646cf53b2b0be32-desc.xcbuild

note: Build preparation complete
note: Building targets in dependency order
WriteAuxiliaryFile /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentLib.build/WebDriverAgentLib-all-non-framework-target-headers.hmap (in target 'WebDriverAgentLib' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
write-file /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentLib.build/WebDriverAgentLib-all-non-framework-target-headers.hmap

ProcessInfoPlistFile /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/Info.plist /Users/xxxxxx/projects/WebDriverAgent/WebDriverAgentLib/Info.plist (in target 'WebDriverAgentLib' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
builtin-infoPlistUtility /Users/xxxxxx/projects/WebDriverAgent/WebDriverAgentLib/Info.plist -producttype com.apple.product-type.framework -expandbuildsettings -format binary -platform iphoneos -requiredArchitecture arm64 -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/Info.plist

CodeSign /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework (in target 'WebDriverAgentLib' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
export CODESIGN_ALLOCATE=/Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "Apple Development: Device Manager (CZ68MXN472)"

/usr/bin/codesign --force --sign 5E67D071FDC1788DF30B703F2A35Fxxxx --timestamp\=none --generate-entitlement-der /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework

/Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework: replacing existing signature

ProcessProductPackaging "" /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/WebDriverAgentRunner.xctest.xcent (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent

Entitlements:

{
"application-identifier" = "6Q34V79NW3.com.facebook.WebDriverAgentRunner.xctrunner";
"com.apple.developer.team-identifier" = 6Q34V79NW3;
"get-task-allow" = 1;
"keychain-access-groups" =     (
    "6Q34V79NW3.com.facebook.WebDriverAgentRunner.xctrunner"
);

}

builtin-productPackagingUtility -entitlements -format xml -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/WebDriverAgentRunner.xctest.xcent

WriteAuxiliaryFile /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/WebDriverAgentRunner-all-non-framework-target-headers.hmap (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
write-file /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/WebDriverAgentRunner-all-non-framework-target-headers.hmap

Copy /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude *.tbd -bitcode-strip all -bitcode-strip-tool /Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip -resolve-src-symlinks /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks
/Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/WebDriverAgentLib -r -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework/WebDriverAgentLib
ProcessInfoPlistFile /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Info.plist /Users/xxxxxx/projects/WebDriverAgent/WebDriverAgentRunner/Info.plist (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
builtin-infoPlistUtility /Users/xxxxxx/projects/WebDriverAgent/WebDriverAgentRunner/Info.plist -producttype com.apple.product-type.bundle.ui-testing -expandbuildsettings -format binary -platform iphoneos -additionalcontentfile /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/ProductTypeInfoPlistAdditions.plist -requiredArchitecture arm64 -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Info.plist

CodeSign /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
export CODESIGN_ALLOCATE=/Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "Apple Development: Device Manager (CZ68MXN472)"
Provisioning Profile: "iOS Team Provisioning Profile: com.*"
                      (41c3a33d-6630-42aa-8029-c531xxxxx)

/usr/bin/codesign --force --sign 5E67D071FDC1788DF30B703F2A35Fxxxxxxx --timestamp\=none --preserve-metadata\=identifier,entitlements,flags --generate-entitlement-der /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework

/Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework: replacing existing signature

GenerateDSYMFile /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest.dSYM /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
/Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest.dSYM

CodeSign /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxx/projects/WebDriverAgent
export CODESIGN_ALLOCATE=/Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "Apple Development: Device Manager (Cxxxxxx)"
Provisioning Profile: "iOS Team Provisioning Profile: com.*"
                      (41c3a33d-6630-42aa-8029-c5311axxxxxx)

/usr/bin/codesign --force --sign 5E67D071FDC1788DF30B703F2A35F0xxxxxx --entitlements /Users/xxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/WebDriverAgentRunner.xctest.xcent --timestamp\=none --generate-entitlement-der /Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest

/Users/xxxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest: replacing existing signature

CodeSign /Users/xxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
cd /Users/xxxxxxx/projects/WebDriverAgent
export CODESIGN_ALLOCATE=/Applications/Xcode-13.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "Apple Development: Device Manager (Cxxxxx472)"
Provisioning Profile: "iOS Team Provisioning Profile: com.*"
                      (41c3a33d-6630-42aa-8029-xxxxxx3)

/usr/bin/codesign --force --sign 5E67D071FDC1788DF30B703F2A35xxxxxxx --entitlements /Users/xxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/WebDriverAgentRunner.xctest.xcent --timestamp\=none --generate-entitlement-der /Users/xxxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app

/Users/xxxxxxe/Library/Developer/Xcode/DerivedData/WebDriverAgent-bhblgbvzcmixaldopxqragzuswth/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app: replacing existing signature

Testing started
2022-10-18 16:52:19.287213+0300 WebDriverAgentRunner-Runner[88728:5746655] Running tests...
Test Suite 'All tests' started at 2022-10-18 16:52:19.746
Test Suite 'WebDriverAgentRunner.xctest' started at 2022-10-18 16:52:19.747
Test Suite 'UITestingUITests' started at 2022-10-18 16:52:19.747
t = nans Suite Set Up
2022-10-18 16:52:19.765902+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
KeyboardAutocorrection
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.766358+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_changedAt"
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.766764+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_buildAtChange"
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.767159+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_previousValue"
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.767520+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
"KeyboardAutocorrection_analyzedAt"
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.776144+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
KeyboardPrediction
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.776555+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
KeyboardShowPredictionBar
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.777206+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
DidShowGestureKeyboardIntroduction
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
2022-10-18 16:52:19.777649+0300 WebDriverAgentRunner-Runner[88728:5746655] [User Defaults] Couldn't write values for keys (
DidShowContinuousPathIntroduction
) in CFPrefsPlistSource<0x280759e80> (Domain: com.apple.keyboard.preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2022-10-18 16:52:19.781
t = 0.00s Set Up
2022-10-18 16:52:19.783028+0300 WebDriverAgentRunner-Runner[88728:5746655] Built at Sep 13 2022 13:18:10
2022-10-18 16:52:19.794985+0300 WebDriverAgentRunner-Runner[88728:5746655] ServerURLHere->http://xxxxxx:8100<-ServerURLHere
2022-10-18 16:52:19.795465+0300 WebDriverAgentRunner-Runner[88728:5746825] Using singleton test manager
2022-10-18 16:52:33.112278+0300 WebDriverAgentRunner-Runner[88728:5746655] Getting the most recent active application (out of 1 total items)
t = 13.35s Find the Application 'com.apple.springboard'
t = 73.35s Requesting snapshot of accessibility hierarchy for app with pid 62
2022-10-18 16:58:30.052277+0300 WebDriverAgentRunner-Runner[88728:5746655] Getting the most recent active application (out of 1 total items)
t = 370.27s Find the Application 'com.apple.springboard'
t = 370.28s Requesting snapshot of accessibility hierarchy for app with pid 62
`

Again first try 73-13=60 sec. second try is like 1 ms

@krishtoautomate
Copy link

Suggestion : if Webdriveragent works without session and appium-xcuitest-driver manages sessions itself based on connections, I think it can save time in session creation as well as connection issues.

@KazuCocoa
Copy link
Member

KazuCocoa commented Oct 23, 2022

As https://github.com/appium/WebDriverAgent#features , the request body should follow the W3C protocol since this one is also ordinally expected to follow WebDriver Protocol. https://github.com/appium/appium-xcuitest-driver/blob/master/lib/driver.js#L1104-L1134 is what the XCUITest driver sends.

The device messages, Find the Application xxx and Requesting snapshot of accessibility xxx, were by XCTest, not Appium/WDA's implemented log messages. It depends on how many the device has apps etc (not sure of the exact condition since the XCTest internal is hidden, so this is just my guess).

I quickly calculated it with a simulator and a real device, with $ curl -X POST -d '{"capabilities": {}}' <url>

  • a simulator
2022-10-22 19:38:35.383277-0700 WebDriverAgentRunner-Runner[47096:9914370] Getting the most recent active application (out of 1 total items)
    t =   188.22s Find the Application 'com.apple.springboard'
    t =   188.24s     Requesting snapshot of accessibility hierarchy for app with pid 46981
  • a real device (tried two patterns, springboard was the front, and com.apple.Preferences was the front)
2022-10-22 19:47:13.832291-0700 WebDriverAgentRunner-Runner[637:135281] Using singleton test manager
2022-10-22 19:48:14.732693-0700 WebDriverAgentRunner-Runner[637:134878] Getting the most recent active application (out of 1 total items)
    t =    61.10s Find the Application 'com.apple.Preferences'
    t =    61.15s     Requesting snapshot of accessibility hierarchy for app with pid 375

So, I don't know the exact reason, but I guess your case is something the device condition specific, or there is some condition in XCTest internal. (at least not with/without session stuff, but something before getting com.apple.Preferences or com.apple.springboard in XCTest internal)

If the device under test many installed apps, I guess it would be help to reduce the installed ones. Then, potentially the application finding by XCTest would become faster

@KazuCocoa
Copy link
Member

KazuCocoa commented Oct 23, 2022

I also tried removing WDA from the device and re-install via the xcodebuild command on both the simulator and the real device, and re-create a simulator instance case as well, but I was not able to see the slowness.

Could you share what the first try means?

in first try

@krishtoautomate
Copy link

May be depends on ios version, I am facing similar issue on os 14.7.1 for device iphone 12 pro and not on ios 16.x versions

@krishtoautomate
Copy link

@KazuCocoa do you think pull accessibility hierarchy is taking time based on size of elements in screen?

is their anyway to know wda activated in device so determine the session without getting snapshot of accessibility xxx

@KazuCocoa
Copy link
Member

I have no exact answer. Only Apple may know of.
I checked the performance in my previous comment with iOS 12, 13 and 16 real devices I have. One of them had 100+ apps installed, but no such delay occurred.

@KazuCocoa
Copy link
Member

KazuCocoa commented Oct 23, 2022

The getting snapshot is used for getting elements etc via XCTest, so maybe it can be skipped only when managing a device via xcrun etc

@jianghuihon
Copy link

jianghuihon commented May 21, 2024

image 你好,我发现遥控端遥控主控设备时耗时很长,通过埋点发现这里耗时1秒多时间,想问下这个问题也是创建会话慢导致的嘛

@KazuCocoa
Copy link
Member

Could you use a translation app and attach English?
I guess you addressed slowness in the API. It is https://appium.github.io/appium-xcuitest-driver/6.0/guides/input-events/ , which is out of control by Appium. For example your running app's thread usage etc also could be related.

@jianghuihon
Copy link

Hello, I found that my remote control device takes a long time to send remote control device instructions through the w3c protocol, Found in a burial site commissioning WDA source inside XCSynthesizedEventRecord * eventRecord = [synthesizer synthesizeWithError: error]; This method takes more than 1 second, want to ask this question is also caused by the slow creation of the session?

@KazuCocoa
Copy link
Member

You might be able to read the device log as well. The method issues iOS's API, How it works usually depends on iOS internal

@jianghuihon
Copy link

Thank you for your reply. Then I would like to ask when you develop this function, such as automatic test games, where a device controls several devices at the same time. In this case, how long does it take for sliding operation to synchronize the screen of the master and the controlled device? The testers on my side would rather play the game on a mobile phone than use tools to achieve the function of multiple devices at the same time

@KazuCocoa
Copy link
Member

I don't have much experience for mobile games. the XCTest usually depends on UI thread usage, so for example if a view use UI thread heavily, usually the action could be slower.

@jianghuihon
Copy link

My following video is the situation of remote control of the main control device, sliding the controlled device feels that the main control device screen response is a little slow

Uploading IMG_0011.MOV…

@jianghuihon
Copy link

IMG_0011.MOV

@jianghuihon
Copy link

The following video is the situation of the controlled device remotely controlling the main control device. Sliding the controlled device feels that the screen response of the main control device takes a long time. You also need such a long response when developing and debugging. In addition, I found the time-consuming place of wda source code by burying debugging in XCSynthesizedEventRecord * eventRecord = [synthesizer SynthesizeWithError: error] here, want to ask what optimization?
#623 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants