[Appium] a tip to launch an iOS app with language and locale

Appium can launch an iOS app with an arbitrary language/locale by XCTest feature. The well known way is appium:language and appium:locale capabilities. The behind is simple. Appium provides -AppleLanguages and -AppleLocale process arguments to the launching process to the application under test.

It means you can launch an arbitrary application with an arbitrary language.

It is mobile: launchApp command. For example, the below launches com.apple.Maps application as English environment. The process can launch as English environment even if the device under test was non-English environment.

driver.terminate_app "com.apple.Maps"
driver.execute_script "mobile: launchApp", {bundleId: "com.apple.Maps", arguments: ["-AppleLanguages","(en)","-NSLanguages","(en)","-AppleLocale","en_US"]}

You should make sure the application process is stopped before starting it. The arguments work only when the process launches. It does not work when the process is running.

1 Comment

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.