Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#1,168 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
文档
描述清晰度
需要澄清
活跃度
停滞
技术栈
ios, python
领域
mobile, testing

调研方向

从链接的 Appium Python Quickstart 和提供的 TestIOSSettings 脚本开始,然后在指定的 iOS 17.2 iPhone 15 上重现 Settings 的启动和与 Screen Time 的交互。完成的标准是记录可靠的指导,说明如何打开 Settings、与其控件交互,以及区分全新启动应用和连接到现有应用。

由索引模型根据 Issue 内容生成。

描述

question

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

主要语言
Python
星标
1.8k
派生
570
平均合并
1 天 10 小时
30 天内合并 PR
24

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

appium/python-client 的其他 Issue

查看 appium/python-client 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。