python 启动IOS APP(iphone),Appium和Selenium的By的用法, By 和AppiumBy


from appium import webdriver
from time import sleep

from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.common.by import By


driver = webdriver.Remote(command_executor = 'http://127.0.0.1:4723/wd/hub',
desired_capabilities = {
"platformName": "ios",
"appium:deviceName": "iPhone Jeff",
"appium:platformVersion": "16.5.1",
"appium:bundleId": "welab.bank.mobile.stage",
"appium:udid": "00008030-000A09C81A43802E"
})
sleep(10)

ele = driver.find_element(AppiumBy.IOS_PREDICATE,"name == '用戶名稱'")
ele.send_keys("qatest101")
driver.find_element(By.ID,"")
sleep(2)


# 参考 External Libraries.site-packages.appium.webdriver.common.appiumby
class AppiumBy(By):
IOS_PREDICATE = '-ios predicate string'
IOS_UIAUTOMATION = '-ios uiautomation'
IOS_CLASS_CHAIN = '-ios class chain'
ANDROID_UIAUTOMATOR = '-android uiautomator'
ANDROID_VIEWTAG = '-android viewtag'
ANDROID_DATA_MATCHER = '-android datamatcher'
ANDROID_VIEW_MATCHER = '-android viewmatcher'
# Deprecated
WINDOWS_UI_AUTOMATION = '-windows uiautomation'
ACCESSIBILITY_ID = 'accessibility id'
IMAGE = '-image'
CUSTOM = '-custom'


#参考selenium

class By:
"""Set of supported locator strategies."""

ID = "id"
XPATH = "xpath"
LINK_TEXT = "link text"
PARTIAL_LINK_TEXT = "partial link text"
NAME = "name"
TAG_NAME = "tag name"
CLASS_NAME = "class name"
CSS_SELECTOR = "css selector"

你可能感兴趣的:(自动化测试,Appium自动化,ios,python,iphone)