本文整理汇总了Python中wda.Client方法的典型用法代码示例。如果您正苦于以下问题:Python wda.Client方法的具体用法?Python wda.Client怎么用?Python wda.Client使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wda
的用法示例。
在下文中一共展示了wda.Client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_preferences
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_preferences(c: wda.Client):
print("Status:", c.status())
print("Info:", c.info)
print("BatteryInfo", c.battery_info())
print("AppCurrent:", c.app_current())
# page_source = c.source()
# assert "</XCUIElementTypeApplication>" in page_source
app = c.session(bundle_id)
selector = app(label="蜂窝网络")
el = selector.get()
el.click()
print("Element bounds:", el.bounds)
logger.info("Take screenshot: %s", app.screenshot())
app.swipe_right()
app.swipe_up()
app(label="电池").scroll()
app(label="电池").click()
示例2: test_client_status
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_client_status(client: wda.Client):
""" Example response
{
"state": "success",
"os": {
"version": "10.3.3",
"name": "iOS"
},
"ios": {
"ip": "192.168.2.85",
"simulatorVersion": "10.3.3"
},
"build": {
"time": "Aug 8 2017 17:06:05"
},
"sessionId": "xx...x.x.x.x.x.x" # added by python code
}
"""
st = client.status() # json value
assert st['state'] == 'success'
# assert 'sessionId' in st
示例3: test_alert_wait
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_alert_wait():
pass
""" Skip because alert not always happens """
# c = wda.Client(__target)
# with c.session('com.apple.Preferences') as s:
# # start_time = time.time()
# assert s.alert.wait(20)
# # print time.time() - start_time
# def test_scroll():
# c = wda.Client()
# with c.session('com.apple.Preferences') as s:
# s(class_name='Table').scroll('Developer')
# s(text='Developer').tap()
# time.sleep(3)
示例4: __init__
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def __init__(self, phone, sensitivity, serverURL, debug, resource_dir):
self.phone = phone
self.sensitivity = sensitivity
self.debug = debug
self.resource_dir = resource_dir
self.step = 0
self.ckpt = os.path.join(self.resource_dir, 'train_logs_coarse/best_model.ckpt-13999')
self.ckpt_fine = os.path.join(self.resource_dir, 'train_logs_fine/best_model.ckpt-53999')
self.serverURL = serverURL
self.load_resource()
if self.phone == 'IOS':
import wda
self.client = wda.Client(self.serverURL)
self.s = self.client.session()
if self.debug:
if not os.path.exists(self.debug):
os.mkdir(self.debug)
示例5: __init__
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def __init__(self, phone, sensitivity, serverURL, debug, resource_dir):
self.phone = phone
self.sensitivity = sensitivity
self.debug = debug
self.resource_dir = resource_dir
self.bb_size = [300, 300]
self.step = 0
self.load_resource()
self.serverURL = serverURL
if self.phone == 'IOS':
import wda
self.client = wda.Client(self.serverURL)
self.s = self.client.session()
if self.debug:
if not os.path.exists(self.debug):
os.mkdir(self.debug)
示例6: test_safari
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_safari(c: wda.Client):
app = c.session("com.apple.mobilesafari")
# app.
示例7: test_xpath
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_xpath(app: wda.Client):
with app:
app.xpath("//*[@label='蓝牙']").click()
assert app.xpath('//*[@label="设置"]').wait()
assert app.xpath('//*[@label="设置"]').get().label == "设置"
# test __getattr__
assert app.xpath('//*[@label="设置"]').label == "设置"
示例8: c
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def c():
return wda.USBClient()
wda.DEBUG = True
__target = os.getenv("DEVICE_URL") or 'http://localhost:8100'
return wda.Client(__target)
示例9: app
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def app(c) -> wda.Client:
return c.session('com.apple.Preferences')
示例10: test_element_tap_hold
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_element_tap_hold(c: wda.Client):
s = c.session()
s(name='Settings').tap_hold(2.0)
assert s(classChain='**/Icon[`name == "Weather"`]/Button[`name == "DeleteButton"`]').get(2.0, raise_error=False)
示例11: test_element_name_matches
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_element_name_matches(c: wda.Client):
s = c.session("com.apple.Preferences")
assert s(nameMatches='^S.ttings?').exists
示例12: test_element_scroll_visible
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_element_scroll_visible(c: wda.Client):
with c.session('com.apple.Preferences') as s:
general = s(name='General')
assert not general.get().visible
general.scroll()
assert general.get().visible
time.sleep(1)
示例13: test_element_scroll_direction
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_element_scroll_direction(c: wda.Client):
with c.session('com.apple.Preferences') as s:
s(className='Table').scroll('up', 0.1)
示例14: test_element_pinch
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_element_pinch(c: wda.Client):
with c.session('com.apple.Maps') as s:
def alert_callback(s):
s.alert.accept()
s.set_alert_callback(alert_callback)
s(className='Button', name='Tracking').tap()
time.sleep(5)
示例15: test_text_contains_matches
# 需要导入模块: import wda [as 别名]
# 或者: from wda import Client [as 别名]
def test_text_contains_matches(c: wda.Client):
with c.session('com.apple.Preferences') as s:
s(text='Bluetooth').get()
assert s(textContains="Blue").exists
assert not s(text="Blue").exists
assert s(text="Bluetooth").exists
assert s(textMatches="Blue?").exists
assert s(nameMatches="Blue?").exists
assert not s(textMatches="^lue?").exists
assert not s(textMatches="^Blue$").exists
assert s(textMatches=r"^(Blue|Red).*").exists