python脚本ui_python 和 Uiautomator2 运行脚本, 报错如下

【前置】

python 安装正常

UIautomator 2 也安装成了, 在C:\Users\Administrator\node_modules_appium-uiautomator2-server@3.1.1@appium-uiautomator2-server\目录下可以查看到appium-uiautomator2-server-debug-androidTest.apk 和appium-uiautomator2-server-v0.3.0.apk 包的。

selenium也安装了, 使用 pip show selenium 能查看到版本号等

【程序】

from appium import webdriver

from selenium.common.exceptions import NoSuchElementException

desired_caps={}

desired_caps['platformName']='Android'

desired_caps['platformVersion']='5.1.1'

desired_caps['deviceName']='127.0.0.1:62025'

desired_caps['app']=r'E:\BaiduNetdiskDownload\App\kaoyan3.1.0.apk'

desired_caps['appPackage']='com.tal.kaoyan'

desired_caps['appActivity']='com.tal.kaoyan.ui.activity.SplashActivity'

desired_caps['noReset']='True'

desired_caps['unicodeKeyboard']='True'

desired_caps['resetKeyboard']='True'

desired_caps['automationName']='uiautomator2'

driver=webdriver.Remote('http://localhost:4723/wd/hub,desired_caps')

driver.implicitly_wait(2)

def Check_CancelBtn():

print('Check Cancel Button')

try:

CancelBtn=driver.find_element_by_id('android:id/button2')

except NoSuchElementException:

print('No Cancel button')

else:

CancelBtn.click()

def Check_SkipBtn():

print('Check Skip button')

try:

SkipBtn=driver.find_element_by_id('com.tal.kaoyan:id/tv_skip')

except NoSuchElementException:

print('No Skip button')

else:

SkipBtn.click()

Check_CancelBtn()

Check_SkipBtn()

【报错如下】

E:\python\python.exe C:/Users/Administrator/PycharmProjects/untitled/Appium/Capability.py

Traceback (most recent call last):

File "C:/Users/Administrator/PycharmProjects/untitled/Appium/Capability.py", line 16, in

driver=webdriver.Remote('http://localhost:4723/wd/hub,desired_caps')

File "E:\python\lib\site-packages\appium\webdriver\webdriver.py", line 97, in init

super(WebDriver, self).init(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)

File "E:\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in init

self.start_session(capabilities, browser_profile)

File "E:\python\lib\site-packages\appium\webdriver\webdriver.py", line 136, in start_session

response = self.execute(RemoteCommand.NEW_SESSION, parameters)

File "E:\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute

self.error_handler.check_response(response)

File "E:\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response

raise exception_class(message, screen, stacktrace)

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

【疑问】

Cannot create property 'replace' on boolean 'true'

不知道这个property ‘replace’ 是指哪里的设置

我是刚开始自学appium 和python, 请大神指教,谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值