Type Method

perform(withKeyModifiers:block:)

Executes block with the given modifier keys held down.

Declaration

class func perform(withKeyModifiers flags: XCUIElement.KeyModifierFlags, block: () -> Void)

Parameters

flags

A set of modifier flags (XCUIElement.KeyModifierFlags) to use while executing the block.

block

The block to execute.

Discussion

This method pushes and pops the modifiers as global state without need for reference to a particular element. Inside the block, elements can be clicked on, dragged from, typed in to, and so on.

See Also

Using Key Modifiers

func typeKey(String, modifierFlags: XCUIElement.KeyModifierFlags)

Types a single key with the specified modifier flags.

struct XCUIKeyboardKey

Constants for use with typeKey(_:modifierFlags:) to represent keys that have no textual equivalent.

struct XCUIElement.KeyModifierFlags

Flags for keyboard modifiers such as shift, control, option, and command.