Skip to main content

IOSManager

The IOSManager class provides iOS Safari automation via Appium with full feature parity to BrowserManager. It supports both iOS Simulators and real devices.

Prerequisites

Constructor

Device Management

listDevices()

List available iOS simulators.
IOSDeviceInfo[]
string
Device name
string
Device UDID
string
Device state (Booted, Shutdown, etc.)
string
iOS runtime version
boolean
Whether device is available
boolean
True if physical device

listRealDevices()

List connected real iOS devices.
IOSDeviceInfo[]
Array of connected physical iOS devices

listAllDevices()

List all devices (simulators + real devices).
IOSDeviceInfo[]
Array of all available iOS devices (real devices first, then simulators)

Launch & Connection

launch()

Launch iOS Safari via Appium. Automatically boots simulator if needed and starts Appium server.
object
string
Device name or partial name match
string
Exact device UDID
boolean
Ignored for iOS (simulators are always visible)
Environment Variables:
  • AGENT_BROWSER_IOS_DEVICE - Default device name
  • AGENT_BROWSER_IOS_UDID - Default device UDID

isLaunched()

Check if browser is launched.
boolean
True if browser is launched

close()

Close browser and cleanup resources.
Navigate to a URL.
string
URL to navigate to
{ url: string; title: string }
Current URL and page title after navigation

getUrl()

Get current page URL.
string
Current page URL

getTitle()

Get page title.
string
Page title

goBack()

Navigate back.

goForward()

Navigate forward.

reload()

Reload the page.

Element Interaction

click()

Click/tap an element.
string
CSS selector or element ref

tap()

Alias for click() with semantic clarity for touch.
string
CSS selector or element ref

type()

Type text into an element.
string
CSS selector or element ref
string
Text to type
object
number
Delay between keystrokes in ms
boolean
Clear field before typing

fill()

Clear and fill an input field.
string
CSS selector or element ref
string
Value to set

check()

Check a checkbox.
string
CSS selector or element ref

uncheck()

Uncheck a checkbox.
string
CSS selector or element ref

select()

Select option(s) from dropdown.
string
CSS selector or element ref
string | string[]
Value(s) to select

clear()

Clear an input field.
string
CSS selector or element ref

focus()

Focus an element.
string
CSS selector or element ref

hover()

Hover over element (scrolls into view on iOS).
string
CSS selector or element ref

Keyboard

press()

Press a key.
string
Key name (Enter, Tab, Escape, Backspace, Delete, ArrowUp, ArrowDown, ArrowLeft, ArrowRight)

Scrolling & Gestures

scroll()

Scroll the page or an element.
object
string
Element to scroll into view
number
Horizontal scroll offset
number
Vertical scroll offset
'up' | 'down' | 'left' | 'right'
Scroll direction
number
Scroll distance in pixels (default: 300)

swipe()

iOS-specific swipe gesture.
'up' | 'down' | 'left' | 'right'
Swipe direction
object
number
Swipe distance in pixels (default: 300)

Snapshots & Element Refs

getSnapshot()

Get page snapshot with element refs.
object
boolean
Only include interactive elements
IOSEnhancedSnapshot
string
Accessibility tree as formatted text
IOSRefMap
Element refs with selector and metadata

getRefMap()

Get cached ref map from last snapshot.
IOSRefMap
Map of refs to element data

Element Queries

getText()

Get element text content.
string
CSS selector or element ref
string
Element text content

getAttribute()

Get element attribute value.
string
CSS selector or element ref
string
Attribute name
string | null
Attribute value or null

getContent()

Get page or element HTML content.
string
Optional CSS selector or element ref
string
HTML content

isVisible()

Check if element is visible.
string
CSS selector or element ref
boolean
True if element is visible

isEnabled()

Check if element is enabled.
string
CSS selector or element ref
boolean
True if element is enabled

count()

Get count of matching elements.
string
CSS selector
number
Number of matching elements

getBoundingBox()

Get element bounding box.
string
CSS selector or element ref
{ x: number; y: number; width: number; height: number } | null
Bounding box or null if element not found

Screenshots

screenshot()

Take a screenshot.
object
string
Output file path
boolean
Capture full page (iOS limitation: may not work)
{ path?: string; base64?: string }
Screenshot result with path or base64 data

JavaScript Execution

evaluate()

Execute JavaScript in page context.
string
JavaScript code to execute
unknown[]
Arguments to pass to the script
T
Script execution result

Wait Functions

wait()

Wait for element or timeout.
object
string
CSS selector or element ref
number
Timeout in milliseconds (default: 30000)
'attached' | 'detached' | 'visible' | 'hidden'
Element state to wait for (default: ‘attached’)

Device Info

getDeviceInfo()

Get current device information.
{ name: string; udid: string } | null
Device info or null if not launched

TypeScript Types