我有类似get操作的输出:
[ { “ field1”:“ 123”, “ field2”:[ “ 10008” ], “ field3”:“ ABC”, “ field4”:[ “ XYZ” ], }]
现在,我要匹配特征文件中的字段4输出。我尝试过以下选项:
当GET方法时 然后状态200 并匹配$ response.field4 [*]包含['XYZ']
但是我没有得到想要的结果并且得到了Karateexception。谁能指导我做错了什么以及如何匹配数组字段的输出。
答案 0 :(得分:1)
请仔细查看您的JSON结构:
2018-12-13 12:29:27 [scrapy.utils.log] INFO: Scrapy 1.5.1 started (bot:
test_webcrawler)
2018-12-13 12:29:27 [scrapy.utils.log] INFO: Versions: lxml 4.2.5.0,
libxml2 2.9.8, cssselect 1.0.3, parsel 1.5.1, w3lib 1.19.0, Twisted
18.9.0, Python 2.7.10 (default, Aug 17 2018, 19:45:58) - [GCC 4.2.1
Compatible Apple LLVM 10.0.0 (clang-1000.0.42)], pyOpenSSL 0.13.1
(LibreSSL 2.2.7), cryptography 2.4.2, Platform Darwin-18.2.0-x86_64-
i386-64bit
2018-12-13 12:29:27 [scrapy.crawler] INFO: Overridden settings:
{'NEWSPIDER_MODULE': 'test_webcrawler.spiders', 'SPIDER_MODULES':
['test_webcrawler.spiders'], 'DUPEFILTER_CLASS':
'scrapy.dupefilters.BaseDupeFilter', 'CONCURRENT_REQUESTS': 1,
'BOT_NAME': 'test_webcrawler', 'LOG_STDOUT': True, 'USER_AGENT':
'circles_bot', 'DOWNLOAD_DELAY': 3}
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 11, in <module>
sys.exit(execute())
:
:
File "/Library/Python/2.7/site-
packages/twisted/internet/_sslverify.py", line 15, in <module>
from OpenSSL._util import lib as pyOpenSSLlib
ImportError: No module named _util