测试积点老人 发表于 2019-6-12 13:51:31

在下小白一枚,在写appium脚本是启动报错,求大神解答,万分感谢!!

在下小白一枚,在写appium脚本是启动报错,求大神解答,万分感谢!!

这个是代码:
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
import yaml
import logging
import logging.config

file=open('../yaml/desired_caps.yaml','r')
data=yaml.load(file)

CON_LOG='../log/log.conf'
logging.config.fileConfig(CON_LOG)
logging=logging.getLogger()

def appium_desired():

    desired_caps = {
      'platformName': data['platformName'],
      'platformVersion': data['platformVersion'],
      'deviceName': data['deviceName'],
      'app': data['app'],
      'appPackage': data['appPackage'],
      'appActivity': data['appActivity'],
      'noReset': data['noReset'],
      'uncodeKeyboard': data['Ture'],
      'resrtKeyboard': data['Ture']
    }

    logging.info('start app...')
    driver = webdriver.Remote('http://' + str(data['ip']) + ':' + str(data['port']) + '/wd/hub', desired_caps)
    driver.implicitly_wait(5)
    return driver

if __name__ == '__main__':
    appium_desired()这个是报错信息:
/usr/local/bin/python3.7 /Users/Neusoft/Python3/kaoyan/page_object/desired_caps.py
/Users/Neusoft/Python3/kaoyan/page_object/desired_caps.py:8: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
data=yaml.load(file)
Traceback (most recent call last):
File "/Users/Neusoft/Python3/kaoyan/page_object/desired_caps.py", line 11, in <module>
    logging.config.fileConfig(CON_LOG)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/config.py", line 71, in fileConfig
    formatters = _create_formatters(cp)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/config.py", line 104, in _create_formatters
    flist = cp["formatters"]["keys"]
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 958, in __getitem__
    raise KeyError(key)
KeyError: 'formatters'

Process finished with exit code 1

abcsell 发表于 2019-6-13 09:29:19

log

qqq911 发表于 2019-6-13 10:51:17

检查下拼写

jingzizx 发表于 2019-6-13 10:56:27

不匹配

梦想家 发表于 2019-6-13 15:58:18

拼写错误
页: [1]
查看完整版本: 在下小白一枚,在写appium脚本是启动报错,求大神解答,万分感谢!!