Appium 关于 uiautomator2 的问题求助

tonys · October 14, 2018 · Last by 笑哼 replied at October 29, 2018 · 1804 hits

当代码中运用 uiautomator2 时就会报如下错误,将·desird_caps['automationName'] = 'uiautomator2'·注释掉后就不会报错,但 APP 的某些元素就会找不到

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot create property 'replace' on boolean 'true'

代码如下:

from appium import webdriver
from selenium.common.exceptions import NoSuchElementException

class appium_kyb():
    def open_kyb(self):
        desird_caps = {}
        desird_caps['platformName'] = 'Android'
        desird_caps['deviceName'] = '127.0.0.1:62026'
        desird_caps['platforVersion'] = '5.1.1'
        desird_caps['automationName'] = 'uiautomator2'
        desird_caps['app'] = r'H:\测试学习\kaoyan3.1.0.apk'
        desird_caps['appPackage'] = 'com.tal.kaoyan'
        desird_caps['appActivity'] = 'com.tal.kaoyan.ui.activity.SplashActivity'

        self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desird_caps)
        self.driver.implicitly_wait(5)
        self.kyb_button()
        self.kyb_skip()

    def kyb_button(self):
        print('寻找取消按钮')
        try:
            button = self.driver.find_element_by_id('android:id/button2')
        except NoSuchElementException:
            print('没有取消升级页面!')
        else:
            button.click()

    def kyb_skip(self):
        print('寻找跳过按钮')
        try:
            skip = self.driver.find_element_by_id('com.tal.kaoyan:id/tv_skip')
        except NoSuchElementException:
            print('没有跳过页面!')
        else:
            skip.click()

appium_q = appium_kyb()
appium_q.open_kyb()

请教各位大神 这个怎么处理啊

共收到 2 条回复 时间 点赞
tonys #1 · October 24, 2018 Author

自顶一个 求解决😂

2Floor has deleted
tonys 回复

升级 appium

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up