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

window/size sometimes returns an incorrect size #879

Closed
Jayxiang opened this issue Mar 29, 2024 · 7 comments
Closed

window/size sometimes returns an incorrect size #879

Jayxiang opened this issue Mar 29, 2024 · 7 comments

Comments

@Jayxiang
Copy link

Jayxiang commented Mar 29, 2024

Simulator iPhone 15 Pro,wda 8.2.1
1 test wda
2 When I click on WDA again and the simulator is in a black screen state, the size I get is 320x480.
3 When I put WDA in the background, the size I get is 393x852.

@KazuCocoa
Copy link
Member

KazuCocoa commented Mar 29, 2024

Could you share the full appium log as well?
I guess it's just wda's project resource config related. I'm not sure if we could do something right now, though.

@Jayxiang
Copy link
Author

I did not use Appium, I only ran this project and tested window/size with Postman. I discovered this issue, and after debugging, I found that this change #834 caused the problem.
Previously, [FBApplication fb_applicationWithPID:appElement.processIdentifier] would call the private API
+ (instancetype)applicationWithPID:(pid_t)processID;
Now it calls fb_applicationWithPID, which results in different behavior when WDA is in the foreground.
When applicationWithPID is used, it returns nil, and then [self fb_systemApplication] is called to obtain the correct size. However, when fb_applicationWithPID is used, it returns an application instance, but the size returned by this instance is incorrect.
截屏2024-03-30
截屏2024-03-30

@KazuCocoa
Copy link
Member

KazuCocoa commented Mar 30, 2024

I confirmed. That PR "fixed" the active device selection.

Before the PR, com.apple.springboard was selected as an active app, as you mentioned when WDA was active (foreground). After the PR, when WDA was active, WDA was selected as an active app, not "sprintgoard". So, the change itself was expected to get foreground app properly.

If you'd like to get the entire window size, It would be safe to check with com.apple.springboard, which is a home screen app for iOS. http://localhost:8100/wda/activeAppInfo endpoint helps to check what app is currently handled as active an WDA.

@KazuCocoa
Copy link
Member

Btw, for example, when you activate an app that does not have resources for high resolution, the get window size would return the app's hight/width. it could be similar to the WDA in your comment. The size info itself is correct as WDA app.

@Jayxiang
Copy link
Author

I see, it seems like adding an interface similar to device/size could be useful.

@KazuCocoa
Copy link
Member

Perhaps #881 is good for it. It returns screen scale info as well (https://appium.github.io/appium-xcuitest-driver/latest/reference/execute-methods/#mobile-devicescreeninfo) so adding the screen size info should be good to add.

@KazuCocoa
Copy link
Member

/wda/screen endpoint will return the screen size of springboard as well since wda 8.4.0

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

No branches or pull requests

2 participants