Appium iOS UI Automation driver
Consists of a client,
UIAutoClient, through which you interact with the iOS UI Automation framework, and a server which is embedded on the device, running the commands in the context of the running application.
In addition, there is a tool,
prepareBootstrap, which builds a script which will be inserted onto the device. Any code that is necessary for running the commands can be added through that tool.
/tmp/instruments_sock), and started, after which commands can be sent using the
;let client = ;clientstart;// send a command to get the source code for the viewlet source = await thisuiAutoClient;
In practice the instantiation of the
UIAutoClient is usually coupled with launching instruments for automating the device. This is handled by awaiting the promises from both that start of
UIAutoClient and the launch of
;;let uiAutoClient = ;let instruments = await utils;await BalluiAutoClientstartinstruments;let source = await thisuiAutoClient;
The second important function is
prepareBootstrap, which is used to create the script which will be injected into the device. This includes custom Appium UI Automation code to fix certain functionality, as well as any other code that necessary.
Basic usage of
prepareBootstrap creates a file with all of the Appium UI Automation code collated into one long script, which can then be put onto the device when launching Instruments:
;let bootstrapPath = await ;
prepareBootstrap can take a hash with any of the following values:
sock- the location of the instruments socket (defaults to
interKeyDelay- the time, in
ms, to pause between keystrokes when typing
justLoopInfinitely- tells the server not to stop looking for new commands
autoAcceptAlerts- automatically accept alerts as they arise
autoDismissAlerts- automatically accept alerts as they arise
sendKeyStrategy- the "strategy" for typing. This can be -
oneByOne- type as normal, one key at a time -
grouped- group together keys to be sent all at once -
setValue- bypass the keyboard and directly set the value on the element rather than actually typing
The last option that can be sent in is
;let bootstrapPath = await;
utils object has a single helper function,
rotateImage, which takes the path to an image, and the degrees to rotate, and executes a custom AppleScript function to rotate the image appropriately. Used to handle screenshots in Appium.
;;// set up client as appropriate// ...let shotFile = '/path/to/file/for/screenshot';await uiAutoClient;// rotate the imageawait utils;let screenshot = await fs;