Help with Python Appium iOS Test Script for Opening Settings and Clicking Buttons
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.8k
- Fork
- 570
- Merge medio
- 1g 10h
- PR unite (30g)
- 24
Descrizione
Hi Appium team,
I’m trying to create a Python test script for iOS using Appium. I followed the Quickstart example for Android, but when I adapted it to an emulated iPhone device, I ran into a few issues.
Currently, I want to:
- Open the iOS Settings app.
- Click a specific button or section (e.g., "Screen Time").
- Assert a certain text exists.
- Understand how to control app launch behavior in Appium:
4a. Start an app fresh: Launch the app as if it has never been opened before on the device (no cached state, fresh session).
4b. Attach to an already running app: Connect to the app if it’s already running on the emulator or device, without restarting it.
import unittest
import warnings
from appium import webdriver
from appium.options.ios import XCUITestOptions
from appium.webdriver.common.appiumby import AppiumBy
options = XCUITestOptions()
options.platform_name = "iOS"
options.automation_name = "XCUITest"
options.device_name = "iPhone 15"
options.platform_version = "17.2"
options.bundle_id = "com.apple.Preferences"
options.language = "en"
options.locale = "US"
# options.device_id = "1F4F5697-3E82-4EC9-819A-9478BDE3E598"
appium_server_url = "http://127.0.0.1:4723"
class TestIOSSettings(unittest.TestCase):
def setUp(self) -> None:
self.driver = webdriver.Remote(command_executor=appium_server_url, options=options)
def tearDown(self) -> None:
if self.driver:
self.driver.quit()
def test_open_screen_time(self) -> None:
el = self.driver.find_element(AppiumBy.IOS_PREDICATE, 'label == "Screen Time"')
el.click()
if __name__ == "__main__":
unittest.main()
Problems I encountered:
- I cannot navigate into Settings reliably; nothing is happening on the emulated iPhone screen.
- I’m unsure how to launch an app fresh vs attach to an already running app.
Could you provide guidance on:
- The correct way to open system apps like Settings and interact with buttons.
- How to launch an app from scratch or attach to an existing session.
Any tips for using iOS emulators specifically with Python/Appium.
Thanks in advance!
Best regards,
Alex
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’Appium Python Quickstart collegato e con lo script TestIOSSettings fornito, quindi riproduci l’avvio di Settings e l’interazione con Screen Time sull’iPhone 15 indicato con iOS 17.2. Il lavoro è completato quando viene documentata una guida affidabile per aprire Settings, interagire con i relativi controlli e distinguere i nuovi avvii dell’app dal collegamento a un’app esistente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- ios, python
- Ambito
- mobile, testing
- Tipo di issue
- Documentazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100