appium / appium-inspector

A GUI inspector for mobile apps and more, powered by a (separately installed) Appium server
https://appium.github.io/appium-inspector/
Other
1.13k stars 282 forks source link

get timeout requests should not be so frequent #736

Closed riginnnn closed 1 year ago

riginnnn commented 1 year ago

Is there an existing issue for this?

Current Behavior

my problem:

When I use appium inspector to start, appium will repeatedly repeat the Executing command 'getTimeouts'. It will take 5 minutes or longer for appium inspector to load。This makes me unable to locate the element in the inspector。

This problem still exists when using appium2 or appium desktop

https://github.com/appium/appium-inspector/issues/734

image

Expected Behavior

Executing command 'getTimeouts' 200

Minimal Reproducible Example

-

Environment

Appium v2.0.0-beta.57 appium inspector:the latest mac xcode:14.2 Real device :iOS15.6

Link to Appium Logs

No response

Futher Information

appium-server-logs.txt

KazuCocoa commented 1 year ago

The behavior itself is expected to keep appium session running, but maybe the interval should be relaxed more

riginnnn commented 1 year ago

该行为本身有望保持 a​​ppium 会话运行,但也许应该放宽间隔

How to relax?ned to add the capabilitie? The main problem is that the appium inspector cannot display the page after loading for a long time

KazuCocoa commented 1 year ago

No, code change is required to relax the interval. Afaik, the loading page waits for both page source result and screenshot result. Other reason might exist, but I'm not so familiar with the logic to render.

riginnnn commented 1 year ago

不,需要更改代码以放宽间隔。Afaik ,加载页面等页面源结果和屏幕截图结果。可能存在于其他原因,但我不太熟悉渍洗。

But I just opened the appium server and appium inspector. There are no other operations and no code. This getTimeouts is not what I requested

riginnnn commented 1 year ago

appium inspector is very slow to load my device, which makes me unable to locate the element

KazuCocoa commented 1 year ago

I haven't seen slowness below in your attached log. Afaik, each getTimeouts request usually ends in a few ms. No idea right now, but potentially running environment specific condition may exist(?)

[debug] [XCUITestDriver@5b81 (790e2de9)] Calling AppiumDriver.getTimeouts() with args: ["790e2de9-7807-4742-b28a-f153a60bc089"]
[debug] [XCUITestDriver@5b81 (790e2de9)] Executing command 'getTimeouts'
[debug] [XCUITestDriver@5b81 (790e2de9)] Responding to client with driver.getTimeouts() result: {"command":3600000,"implicit":0}
[HTTP] <-- GET /session/790e2de9-7807-4742-b28a-f153a60bc089/timeouts 200 19339 ms - 42
[HTTP] 
[debug] [XCUITestDriver@5b81 (790e2de9)] Responding to client with driver.getTimeouts() result: {"command":3600000,"implicit":0}
[HTTP] <-- GET /session/790e2de9-7807-4742-b28a-f153a60bc089/timeouts 200 14335 ms - 42
[HTTP] 
[debug] [XCUITestDriver@5b81 (790e2de9)] Responding to client with driver.getTimeouts() result: {"command":3600000,"implicit":0}
[HTTP] <-- GET /session/790e2de9-7807-4742-b28a-f153a60bc089/timeouts 200 9342 ms - 42
[HTTP] 
[debug] [XCUITestDriver@5b81 (790e2de9)] Responding to client with driver.getTimeouts() result: {"command":3600000,"implicit":0}
[HTTP] <-- GET /session/790e2de9-7807-4742-b28a-f153a60bc089/timeouts 200 7 ms - 42
jlipps commented 1 year ago

yeah the get timeouts thing is unrelated to a slow session load. the inspector just calls get timeouts to keep the session alive.

riginnnn commented 1 year ago

I think the App Source is too complex and the appium inspector renders slowly. Can it improve the rendering speed?

jlipps commented 1 year ago

It's not that the inspector renders it slowly. It's that XCUITest/iOS takes forever to respond with it. I'm going to close this issue now as it seems the root cause is just slowness of getting the app source, which has nothing to do with the inspector.

MobileAut commented 9 months ago

I facing the similar issue where Appium inspector is very slow to load my device, which makes me unable to locate the element. MacBook Pro (Apple M1 Prod) - Ventura 13.6 Appium Version - 2.2.1 Appium Inspector - 2023.11.1 appium driver list ✔ Listing available drivers

{ "appium:deviceName": "iPhone 15", "appium:app": "sim.app PATH", "appium:automationName": "XCUITest", "appium:platformName": "iOS", "appium:platformVersion": "17.0", "appium:bundleId": "com.xxxxxxx", "appium:usePrebuiltWDA": false }

Log:

[HTTP] <-- GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/screenshot 200 348 ms - 3121552 [HTTP] [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/window/rect [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getWindowRect() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getWindowRect' [XCUITestDriver@13e1 (d6010042)] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/5499C62A-1658-402C-9371-E621400F786D/window/size] with no body [Xcode] 2023-11-27 12:16:31.939349-0600 WebDriverAgentRunner-Runner[2996:2017925] Getting the most recent active application (out of 1 total items) [Xcode] [Xcode] t = 6.60s Requesting snapshot of accessibility hierarchy for app with pid 3004 [Xcode] [XCUITestDriver@13e1 (d6010042)] Got response with status 200: {"value":{"width":393,"height":852},"sessionId":"5499C62A-1658-402C-9371-E621400F786D"} [XCUITestDriver@13e1 (d6010042)] Responding to client with driver.getWindowRect() result: {"width":393,"height":852,"x":0,"y":0} [HTTP] <-- GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/window/rect 200 89 ms - 48 [HTTP] [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/source [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getPageSource() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getPageSource' [XCUITestDriver@13e1 (d6010042)] Matched '/source?format=xml&scope=AppiumAUT' to command name 'getPageSource' [XCUITestDriver@13e1 (d6010042)] Proxying [GET /source?format=xml&scope=AppiumAUT] to [GET http://127.0.0.1:8100/session/5499C62A-1658-402C-9371-E621400F786D/source?format=xml&scope=AppiumAUT] with no body [Xcode] 2023-11-27 12:16:32.025127-0600 WebDriverAgentRunner-Runner[2996:2017925] Getting the most recent active application (out of 1 total items) [Xcode] [Xcode] 2023-11-27 12:16:32.025974-0600 WebDriverAgentRunner-Runner[2996:2017925] The following attributes were requested to be included into the XML: {( [Xcode] FBTypeAttribute, [Xcode] FBYAttribute, [Xcode] FBLabelAttribute, [Xcode] FBIndexAttribute, [Xcode] FBXAttribute, [Xcode] FBNameAttribute, [Xcode] FBHeightAttribute, [Xcode] FBAccessibleAttribute, [Xcode] FBValueAttribute, [Xcode] FBVisibleAttribute, [Xcode] FBWidthAttribute, [Xcode] FBEnabledAttribute [Xcode] )} [Xcode] [Xcode] 2023-11-27 12:16:32.026165-0600 WebDriverAgentRunner-Runner[2996:2017925] Waiting up to 2s until com.wholefoods.WholeFoods is in idle state (including animations) [Xcode] t = 6.69s Wait for com.wholefoods.WholeFoods to idle [Xcode] [Xcode] t = 6.69s Requesting snapshot of accessibility hierarchy for app with pid 3004 [Xcode] [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/timeouts [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getTimeouts() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getTimeouts' [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/timeouts [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getTimeouts() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getTimeouts' [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/timeouts [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getTimeouts() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getTimeouts' [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/timeouts [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getTimeouts() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getTimeouts' [Xcode] 2023-11-27 12:18:17.093508-0600 WebDriverAgentRunner-Runner[2996:2017925] Cannot take a snapshot with attribute(s) ( [Xcode] "XC_kAXXCAttributeLabel", [Xcode] "XC_kAXXCAttributeTraits", [Xcode] "XC_kAXXCAttributeHorizontalSizeClass", [Xcode] "XC_kAXXCAttributePlaceholderValue", [Xcode] "XC_kAXXCAttributeBannerIsStickyAttribute", [Xcode] "XC_kAXXCAttributeIdentifier", [Xcode] "XC_kAXXCAttributeWindowDisplayId", [Xcode] "XC_kAXXCAttributeIsUserInteractionEnabled", [Xcode] "XC_kAXXCAttributeURL", [Xcode] "XC_kAXXCAttributeUserTestingElements", [Xcode] "XC_kAXXCAttributeHasNativeFocus", [Xcode] "XC_kAXXCAttributeVerticalSizeClass", [Xcode] "XC_kAXXCAttributeTruncatedValue", [Xcode] "XC_kAXXCAttributeViewControllerTitle", [Xcode] "XC_kAXXCAttributeFrame", [Xcode] "XC_kAXXCAttributeWindowContextId", [Xcode] "XC_kAXXCAttributeSystemAutomationProperties", [Xcode] "XC_kAXXCAttributeParent", [Xcode] "XC_kAXXCAttributeAutomationType", [Xcode] "XC_kAXXCAttributeViewControllerClassName", [Xcode] "XC_kAXXCAttributeElementType", [Xcode] "XC_kAXXCAttributeElementBaseType", [Xcode] "XC_kAXXCAttributeIsVisible" [Xcode] [Xcode] ) of 'XCUIElementTypeAny' after 15.00 seconds [Xcode] 2023-11-27 12:18:17.094967-0600 WebDriverAgentRunner-Runner[2996:2017925] This timeout could be customized via 'customSnapshotTimeout' setting [Xcode] 2023-11-27 12:18:17.095083-0600 WebDriverAgentRunner-Runner[2996:2017925] Internal error: Error kAXErrorIPCTimeout getting snapshot for element <AXUIElementRef 0x600000c28090> {pid=3004} {uid=[ID:1 hash:0x0]} [Xcode] 2023-11-27 12:18:17.095180-0600 WebDriverAgentRunner-Runner[2996:2017925] Falling back to the default snapshotting mechanism for the element 'XCUIElementTypeAny' (some attribute values, like visibility or accessibility might not be precise though) [Xcode] [HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/timeouts [HTTP] {} [XCUITestDriver@13e1 (d6010042)] Calling AppiumDriver.getTimeouts() with args: ["d6010042-e94c-40e0-b905-a2c75a456c8f"] [XCUITestDriver@13e1 (d6010042)] Executing command 'getTimeouts'

Any help really appreciated.

KazuCocoa commented 9 months ago

I guess your case is the response of the get page source related.

[HTTP] --> GET /session/d6010042-e94c-40e0-b905-a2c75a456c8f/source
[HTTP] {}

I assume pageSourceExcludedAttributes in the settings API would help to skip calculating some attributes to make the endpoint call lighter. As a typical case, excluding visible would help. https://appium.github.io/appium-xcuitest-driver/5.11/settings/