Mac2 driver support Multi displays

Now I use Mac2 driver to test our application,but our application support multi displays,
How can i test it?
There are a lot problems,
Such as
getScreenShot,Only can get MainScreen
No support swichTo WindowHadle…

there is no point in hawing switchTo in this driver as XCTest puts all windows into the app page tree, does not matter to which display they belong. Regarding screenshots, - it is possible to add an improvement, which would allow to provide a custom display identifier to take a screenshot from

That sounds great,I’m looking forward to the end of this feature

The feature has been merged to mac2 driver. You could try it by updating the driver to the most recent version. Note, that recent driver versions are only compatible with Appium2

2 Likes

hi, I see this new interface “macos: screenshots”,There have other question here is how do I get the displayID of multiple monitors?Please help me

these are present in the resulting JSON if the command is called without arguments. Read https://github.com/appium/appium-mac2-driver#macos-screenshots

Thanks you for first
Another problem I have is that this error occurs after I upgrade to V2
appium:2.0.0-beta.27
[email protected] [installed (NPM)]
Could you help me to resolve it

2022-03-30 16:37:07:453 - [debug] [AppiumDriver@b4e1] Responding to client with driver.getSessions() result: [{“id”:“54d1cd6a-f516-4b19-99b6-21197dbf119f”,“capabilities”:{“platformName”:“mac”,“automationName”:“Mac2”,“bundleId”:“com.ringcentral.rooms”,“createSessionTimeout”:10000,“newCommandTimeout”:30000,“noReset”:true,“udid”:“fgsdfgsd”}}]
2022-03-30 16:37:07:454 - [HTTP] <-- GET /wd/hub/sessions 200 2 ms - 242
2022-03-30 16:37:07:454 - [HTTP]
2022-03-30 16:37:08:062 - [HTTP] --> GET /wd/hub/session/54d1cd6a-f516-4b19-99b6-21197dbf119f/source
2022-03-30 16:37:08:062 - [HTTP] {}
2022-03-30 16:37:08:062 - [debug] [Mac2Driver@7d3c (54d1cd6a)] Would have proxied command directly, but a plugin exists which might require its value, so will let its value be collected internally and made part of plugin chain
2022-03-30 16:37:08:062 - [debug] [Mac2Driver@7d3c (54d1cd6a)] Calling AppiumDriver.getPageSource() with args: [“54d1cd6a-f516-4b19-99b6-21197dbf119f”]
2022-03-30 16:37:08:062 - [AppiumDriver@b4e1] Plugins which can handle cmd ‘getPageSource’: images
2022-03-30 16:37:08:062 - [AppiumDriver@b4e1] Plugin images is now handling cmd ‘getPageSource’
2022-03-30 16:37:08:062 - [AppiumDriver@b4e1] Executing default handling behavior for command ‘getPageSource’
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] Encountered internal error running command: Error: The default behavior for this command was to proxy, but the driver did not have the ‘proxyCommand’ method defined. To fully support plugins, drivers should have ‘proxyCommand’ set to a jwpProxy object’s ‘command()’ method, in addition to the normal ‘proxyReqRes’
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at defaultBehavior (/Users/rcadmin/.nvm/versions/node/v12.22.3/lib/node_modules/appium/lib/appium.js:525:17)
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at ImageElementPlugin.handle (/Users/rcadmin/.appium/node_modules/@appium/images-plugin/lib/plugin.js:78:18)
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at wrappedCmd (/Users/rcadmin/.nvm/versions/node/v12.22.3/lib/node_modules/appium/lib/appium.js:587:29)
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at AppiumDriver.executeWrappedCommand (/Users/rcadmin/.nvm/versions/node/v12.22.3/lib/node_modules/appium/lib/appium.js:620:22)
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at AppiumDriver.executeCommand (/Users/rcadmin/.nvm/versions/node/v12.22.3/lib/node_modules/appium/lib/appium.js:549:28)
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at runMicrotasks ()
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at processTicksAndRejections (internal/process/task_queues.js:97:5)
2022-03-30 16:37:08:063 - [debug] [Mac2Driver@7d3c (54d1cd6a)] at asyncHandler (/Users/rcadmin/.nvm/versions/node/v12.22.3/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:315:19)

start appium: appium -p %APPIUM_PORT% --allow-insecure get_server_logs --log-timestamp --local-timezone --base-path /wd/hub --use-plugins=relaxed-caps,images

please update the driver to v 1.1.5+ and try again

it looks like working well,thanks :pray:

1 Like

HI,I’m having a problem here with multiple screens and trying to determine if the element is on the main screen,could you give me a suggestion🙏

XCTest does not provide such data. The first that comes to my mind would be to take a screenshot of a display and then use OpenCV to find element’s screenshot occurrence(s) there

there are elements that exist on multiple screens, and now we need to distinguish which screen they are on, and I started with location, but I found that there’s no way to be completely sure of that value,Could you give a suggestion how can i make sure MainScreen is x:0->1920,y 0->1080. second Screen(x:1920->3840,y:1080->2160), OpenCV will cause a lot time,I don’t think it fits

@1148 Hi, did you manage to detect a second screen using Mac2 driver?