刚开始接触,记录一下.
appium启动app,有两种,浏览器和非浏览器,启动参数是不一样的,现在很多的apk内部是使用的webview,要操作就要切换进相应webview,启动参数要增加相应的driver。
demo:
if __name__ == '__main__':
desired_caps = dict()
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '8'
desired_caps['deviceName'] = '[HUAWEI] EVA-AL00'
desired_caps['appPackage'] = 'com.seewo.picbook.demo'
desired_caps['appActivity'] = 'com.seewo.picbook.component.guide.ui.GuideActivity'
# desired_caps['appPackage'] = 'com.seewo.push.sign'
# desired_caps['appActivity'] = 'com.seewo.library.push.demo.MainActivity'
desired_caps['noReset'] = 'True'
desired_caps['chromedriverExecutable'] = 'd:\download\chromedriver-77.exe'
data = [
"http://172.20.124.43:20000/wd/hub",
desired_caps
]
akw = AppiumKeyword()
akw.openApplication(data)
time.sleep(5)
# akw.input_text("id=com.seewo.easiblink_apk:id/url","https://enow-kernel.test.seewo.com/view?from=remote&type=EN5_share&accessCode=e66d257a45474ed089595f556c45daa2#/enbx/2018")
# time.sleep(3)
# akw.input_text("id=com.seewo.easiblink_apk:id/url", "https://baidu.com")
webview = akw.get_contexts()
akw.switch_to_context('WEBVIEW_com.seewo.picbook.demo')
# akw._element_find("id=main-tool-layer-user-info", True, True).click()
ele = akw._element_find('css=#main-tool-layer-user-info',True,True)
akw.Tap(['css=.style_head-img_1hOo0'])
# akw.pressKeycode(['24'])
# q = akw.executeScript(["return document.querySelector('video').paused"])
# akw.
# _driver = akw._cache.current
# _driver.open_notifications()
问题:
desired_caps['chromeOptions'] = {'w3c': False}