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"文章来源地址https://www.toymoban.com/news/detail-754395.html
文章来源:https://www.toymoban.com/news/detail-754395.html
到了这里,关于python 启动IOS APP(iphone),Appium和Selenium的By的用法, By 和AppiumBy的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!