appium / appium/python-client

Help with Python Appium iOS Test Script for Opening Settings and Clicking Buttons

オープン
#1,168 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

question
主要言語
Python
スター
1.8k
フォーク
570
平均マージ
1日 10時間
マージ済み PR(30日)
24

説明

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:

  1. Open the iOS Settings app.
  2. Click a specific button or section (e.g., "Screen Time").
  3. Assert a certain text exists.
  4. 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:

  1. I cannot navigate into Settings reliably; nothing is happening on the emulated iPhone screen.
  2. 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされている Appium Python Quickstart と提供された TestIOSSettings スクリプトから始め、指定された iOS 17.2 の iPhone 15 で Settings の起動と Screen Time とのインタラクションを再現してください。完了条件は、Settings の開き方、そのコントロールとのインタラクション方法、およびアプリの新規起動と既存のアプリへのアタッチを区別する方法について、信頼できるガイダンスを文書化することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ios, python
領域
mobile, testing
issue の種類
ドキュメント
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。